这一节我们将dele.php和sys.php放上来.
---------
//dele.php
require("sys.php");
if ($Submit)
{
if ($password<>$managepwd)
{$errorm="密码错误.无权操作..";}
else
{
$content=file($guestfile);
$message=$content[$record-1];
$count=count($content);
if ($dele=="delreply")
{
$replylen=strlen(strstr($message,"<!--reply>"));
$long=strlen($message);
$len=$long-$replylen;
$message=substr($message,0,$len);
}
else
{$message="";}
//writefile
$fp=fopen($guestfile,"w");
for ($i=0;$i<$count;$i++)
{
if ($i==($record-1)){$content[$i]=$message;}
fputs($fp,$content[$i],strlen($content[$i]));
}//end for
fclose($fp);
echo "";
exit;
}
}// end ifSubmit
$content=file($guestfile);
$message=$content[$record-1];
$found=ereg("<!--reply>",$message);
?>
------
//sys.php
$managepwd='zihanonline';
$guestfile="guest.txt";
function check_strlen_long($txt)
{
$count=0;
$arrtemp=$txt;
$len=strlen($txt);
$txt=$txt.' ';
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>=70)
{
for ($j=$i;$j<$len;$j++)
{
$txt[$j+1]=$arrtemp[$j];
}
$txt[$i]="n";
$len=$len+1;
$txt[$len]=$arrtemp[$len-1];
$count=0;
$arrtemp=$txt;
}//end if count
}
$txt=trim($txt);
return $txt;
}//end function
function encode ($txt)
{
$txt=strip_tags($txt);
$txt=htmlspecialchars($txt);
$message=StripSlashes($txt);
return $message;
}
function ubb($txt)
{
}
?>