現在我們來講一下reply.PHP的代碼:
---------------------------------
//reply.PHP
<?
function check_strlen_long($txt)
{
$len=strlen($txt);
$count=0;
for ($i=0;$i<$len;$i++)
{
if (ord($txt[$i])<128)
{ $count=$count+1;}
if (ord($txt[$i])==10 or ord($txt[$i])==32)
{$count=0;}
if ($count>=60)
{
$txt[$i]="n";
$count=0;
}
}
return $txt;
}
function encode ($txt)
{
$txt=strip_tags($txt);
$txt=Htmlspecialchars($txt);
$message=StripSlashes($txt);
return $message;
}
$content=file("guest.txt");
$disptext=$content[$record-1];
if ($job=="addreply" and $replyname!="" and $replycontent!="")
{
$content=file("guest.txt");
$count=count($content);
$time = date(Y年m月d日H小時i分);
$ip=$REMOTE_ADDR;
$replycontent=StripSlashes($replycontent);
$replyname=encode($replyname);
$replycontent=Htmlspecialchars($replycontent);
$replycontent=check_strlen_long($replycontent);
$replycontent=nl2br($replycontent);
$replycontent=ereg_replace(chr(10),"",$replycontent);
$content[$record-1]=substr($content[$record-1],0,strlen($content[$i])-1); $content[$record-1]=$content[$record-1]."<!--reply><tr><td colspan=4><ul><font color=#AB00E1>回復內容:</font><br>".$replycontent."<br>回復人大名:".$replyname."<br><font color=#CC33FF>