限制了发帖字数,这个是接下来的代码。
HTML 代码:
<?php
 }
}elseif($action=="edit"){
    if($chgadd){
	   $dh=opendir("user/");$i=0;
	while ($userfile=readdir($dh)) {
		if (($userfile!=".") && ($userfile!="..") && ($userfile!="") && strpos($userfile,".php")) {
			$useri=explode("|",readfrom("user/$userfile"));
		if($subpass==$useri[2] && $supadmin==$useri[1])
			$i=1;}}if($i!=1){msg_box("操作错误","管理员或密码错了!");exit;}
	  else{$nowtime=nowtime();
$msg.="[align=right][color=gray][此贴被 $supadmin 在{$nowtime}修改过][/color][/align]";
$article=file($datafile);
$xiugai=explode("|",$article[$id]);
$msg=ereg_replace("\n","<br>",$msg);
$xiugai[4]=$msg;
$article[$id]=implode('|',$xiugai);
$article=implode("",$article);
$f = fopen($datafile,"w");
fputs($f,$article);
jump_page("index.php","修改留言成功","恭喜版主成功修改留言! <br><br>程式已经为您自动登录<br><br>如果程式无法登陆首页请点击这<br><ul><li><a href=index.php>点击这里进入首页</a></li></ul>");}}
else {$txt=file($datafile);$detail=explode("|",$txt[$id]);
	echo"<html><head><title>修改留言</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\"><link rel=\"stylesheet\" href=\"img/css.css\"></head><body background=img/bg.gif><center><form method=\"post\" action=\"write.php?action=edit&id=$id\"><table><tr><td>&nbsp;斑竹:&nbsp;</td><td><input type=\"text\" name=\"supadmin\"></td></tr><tr><td>斑竹密码:</td><td><input type=\"password\" name=\"subpass\"></td></tr><tr><td>原贴内容:</td><td><textarea name=\"msg\" cols=\"50\" rows=\"10\">$detail[4]</textarea></td></tr><tr><td><input  class=input2  type=\"submit\" name=\"chgadd\" value=\"确定修改\" style=\"height:20px;background-color:#f3f3f3;border:1 solid black\" onMouseOver =\"this.style.backgroundColor='#FFC864'\" onMouseOut =\"this.style.backgroundColor='#f3f3f3'\"></td></tr></table></form></center>";
	}
}elseif($action=="reply"){
    if($repsub){
	   $dh=opendir("user/");
		$i=0;
	while ($userfile=readdir($dh)) {
		if (($userfile!=".") && ($userfile!="..") && ($userfile!="") && strpos($userfile,".php")) {
			$useri=explode("|",readfrom("user/$userfile"));
		if($subpass==$useri[2] && $supadmin==$useri[1])
			$i=1;}
		}
		 if($i!=1){msg_box("密码错误","管理员或密码错了!");exit;}
	  else{
		  $msg=ubb($msg);
		 $nowtime=nowtime();
		 $fp=fopen($datafile,"r");
		  $headmsg="";$check=1;$temp="";
		  while($check){
			  $headmsg=$headmsg.$temp;
			  $nowline=fgets($fp,5000);
			  $temp=$nowline;
			  $nowmsg=explode("|",$nowline);
			  if($nowmsg[0]==$id){$check=0;}
		  }
		  $footmsg=fread($fp,filesize($datafile));
		  fclose($fp);
		  $nowmsg[7]++;
		  $nowmsg[8].="<tr><td bgcolor=#f9f3f5 width=25%  align=center>版主<font color=#FF33CC>$supadmin</font>回复:</td><td bgcolor=#f9f3f5 >$msg</td></tr>";
		  $nowmsg2=implode("|",$nowmsg);
		  $writemsg="$headmsg$nowmsg2$footmsg";
		  $fp=fopen($datafile,"w");
		  fwrite($fp,$writemsg);
		  fclose($fp);
	 jump_page("index.php","回复留言成功","恭喜您已经成功回复留言! <br><br>程式已经为您自动登录<br><br>如果程式无法登陆首页请点击这<br><ul><li><a href=index.php>点击这里进入首页</a></li></ul>");
		
	  }
	}
	else {
	echo"<html><head><title>发表回复</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\"><link rel=\"stylesheet\" href=\"img/css.css\"></head><body background=img/bg.gif><center><form method=\"post\" action=\"write.php?action=reply&id=$id\"><table><tr><td>&nbsp;斑竹:&nbsp;</td><td><input type=\"text\" name=\"supadmin\"></td></tr><tr><td>斑竹密码:</td><td><input type=\"password\" name=\"subpass\"></td></tr><tr><td>回复内容:</td><td><textarea name=\"msg\" cols=\"50\" rows=\"10\"></textarea></td></tr><tr><td><input  class=input2  type=\"submit\" name=\"repsub\" value=\"确定回复\" style=\"height:20px;background-color:#f3f3f3;border:1 solid black\" onMouseOver =\"this.style.backgroundColor='#FFC864'\" onMouseOut =\"this.style.backgroundColor='#f3f3f3'\"></td></tr></table></form></center>";
	}
}elseif($action=="del"){
	if($delsub){
		$dh=opendir("user/");
		$i=0;
	while ($userfile=readdir($dh)) {
		if (($userfile!=".") && ($userfile!="..") && ($userfile!="") && strpos($userfile,".php")) {
			$useri=explode("|",readfrom("user/$userfile"));
		if($subpass==$useri[2] && $supadmin==$useri[1])
			$i=1;}
		}
		 if($i!=1){msg_box("密码错误","管理员或密码错了!");exit;}
		else{
			 $notelist=file($datafile);
            unset($notelist[$id]);
            $notelist=implode("",$notelist);
            $f=fopen($datafile,"w");
            fputs($f,$notelist);
			jump_page("index.php","删除成功","帖子已经成功删除! <br><br>程式已经为您自动登录<br><br>如果程式无法登陆首页请点击这<br><ul><li><a href=index.php>点击这里进入首页</a></li></ul>");
		}
	}
	else{
		echo"<html><head><title>删除留言</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\"><link rel=\"stylesheet\" href=\"img/css.css\"></head><body background=img/bg.gif><center><form method=\"post\" action=\"write.php?action=del&id=$id&delsub=1\"><BR><BR><br>&nbsp;斑竹:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"text\" name=\"supadmin\"><BR><BR><BR>斑竹密码:&nbsp;&nbsp;&nbsp;<input type=\"password\" name=\"subpass\"><BR><BR>&nbsp;&nbsp;&nbsp;<input type=\"submit\" name=\"delsub\" value=\"删除\"style=\"height:20px;background-color:#f3f3f3;border:1 solid black\" onMouseOver =\"this.style.backgroundColor='#FFC864'\" onMouseOut =\"this.style.backgroundColor='#f3f3f3'\"><!--<input type=\"hidden\" name=\"id\" value=\"$id\">--></form>";
	}
}
function writeto($file_name,$infoata,$method="w") {
	$filenum=@fopen($file_name,$method);
	flock($filenum,LOCK_EX);
	$file_data=fwrite($filenum,$infoata);
	fclose($filenum);
	return $file_data;
}?>