이 스크립트는 이전 버전의 스크립트라는 것을 알고 있지만, 제대로 작동하려면 도움을 청하는 데 감사드립니다. 몇 년 전만해도 이 좋았지 만 요즘은 재미있어하고 있습니다. 서식을 제발 ....악센트 부호가있는 문자 표시를 수정하려면 어떻게합니까?
브라우저에서 실행할 때 프랑스어 악센트 부호가있는 문자 이 제대로 표시되지 않습니다. 그러나 생성하는 텍스트 파일에서 그들은 잘 보입니다. 여기서 무슨 일이 일어나고있는거야? Hélène Rollan
및 파일 : Hélène Rollan
: Coeur à l`écoute
및 파일 : Coeur à l`écoute
펄 버전 v5.20.2 내 데이터베이스 utf8_unicode_ci이 표는 브라우저에서
을 utf8_unicode_ci되고, MySQL은입니다
#!/usr/bin/perl --
use utf8;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw (:standard);
$q = new CGI;
use Encode;
use open ':encoding(utf8)';
binmode(STDOUT, ":unix:utf8");
$user = "manager";
require "config.cgi";
&Create_DB_Connection;
$time = time();
sub Create_DB_Connection{
use DBI;
$DSN = "DBI:mysql:$mysql_database:$mysql_hostname";
$dbh = DBI->connect($DSN, "$mysql_username", "$mysql_password", {mysql_enable_utf8 => 1}) || die return;
if ($dbh) { $connected = "YES"; }
return;
}
sub Do_SQL{
eval{
$sth = $dbh->prepare($SQL);
};
$dbh->do(qq{SET NAMES 'utf8';});
$sth->execute;
return ($sth);
}
&downline;
# Prepare and show tree of affiliates
sub downline {
($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime(time());
$month = $mon;
$year = $year + 1900;
print $q->header;
print<<EOF;
<HTML><HEAD><TITLE>Network Summary</TITLE>
<meta http-equiv="Content-type" content="text/html;charset=utf-8" />
</HEAD>
<style type="text/css">
<!--
A:visited {text-decoration: none;}
A:hover {text-decoration: underline;}
A:link {text-decoration: none;}
A:active {text-decoration: none;}
.MEMBERS {font-size: 8pt; text-decoration: none; font-family: Verdana,verdana; color: FF0000;}
-->
</style>
<BODY BGCOLOR="FFFFFF" TEXT="000000" LINK="000080" VLINK="004080">
<center><font size=4 face=arial color=000000><b>Network Summary as of $month/$year</b><br>
<font face=verdana,arial size=1><a href=wmstats_en2.cgi>[return to main page]</a></font></center>
<p>
EOF
$featured_file = "/home/bruce/data/featured.txt";
$SQL="SELECT FIRST_NAME,LAST_NAME,SPONSOR_ID,CO_SPONSOR_ID,ID FROM main_members";
&Do_SQL;
while ($row = $sth->fetchrow_hashref){
$info{$row->{'ID'}} = [$row->{'FIRST_NAME'},$row->{'LAST_NAME'},$row->{'SPONSOR_ID'}];
push @{ $kids{$row->{'CO_SPONSOR_ID'}} }, $row->{'ID'};
}
$kid = "$user";
if (!$kids{$kid}) {
print<<EOF;
<center><b><font size=2 face=arial>There are currently no members in your downline</font></b><font size=4 face=arial color=000000><br><BR>
EOF
} else {
&crunch(1);
}
$o++;
sub crunch {
foreach $kid (@{ $kids{$kid} }) {
$newlevel++;
$payouts{$newlevel}++;
$levels{$newlevel}++;
$total_downline++;
while ($b < $newlevel) { $report .= " "; $b++; } $b=0;
$report .= "$newlevel: $kid - $info{$kid}[0] $info{$kid}[1] <br>";
# I added this to generate a text file
open (FILE, ">>$featured_file");
flock(FILE, 2);
print FILE "$newlevel: $kid - $info{$kid}[0] $info{$kid}[1] \n";
flock(FILE, 8);
close (FILE);
&crunch($newlevel);
$newlevel--;
delete($info{$kid});
}
}
print<<EOF;
<center><table><tr><td valign=top nowrap>
<font face=verdana size=2>
$report
</td><td valign=top>
<table cellpadding=0><tr>
<td align=right nowrap><font face=verdana,arial size=2><b>Total Downline:<p> </td><td><font face=verdana,arial size=2><b> $total_downline<p> </td></tr>
EOF
while (!$found_some) { $i++;
if ($levels{$i}) {
print<<EOF;
<tr><td align=right><font face=verdana,arial size=2><b>Level $i:</td><td><font face=verdana,arial size=2><b> $levels{$i}</td></tr>
EOF
} else { $found_some = 1; }
}
print<<EOF;
</td></tr></table>
<p><font face=verdana size=2><b>
</TD></TR></TABLE></TD></TR></TABLE>
EOF
}
10 줄까지 줄일 수 있습니까? – ikegami
데이터베이스에서 데이터가 정확한지 확인하기 위해'HEX (the_field_in_question) 선택'출력을 제공해 주시겠습니까? – ikegami