文本多用户留言簿(1)

# 【程序功能】
#   一般人都找不到好的而且只是用文本作为数据库的留言簿,所以写了这个东西
#   本留言簿的界面是taiwe作的,在这里感谢他。
#   这个留言簿具备了普通留言簿的一切功能,还包括了帖子的删除等等,加入了
# 斑竹留言回复,带有OICQ号码的在线判断功能,允许大家申请,管理员可以删
# 除申请的用户,功能非常强大!
#   还有就是一些公用的函数都放在了函数部分,大家可以很方便的修改,呵呵
#   对于程序的安装设置也是非常简单,如果大家怕麻烦,可以运行run.php
# 她会帮你修改所有文件的属性!对于变量的设置请参见设置部分。
#########################################################################################
# 请您尊重我们的劳动和版权,不要删除以上的版权声明部分,谢谢合作!!
#########################################################################################
####################################设置部分#############################################
$admin[path]="./data";                ##数据库文件的路径
$admin[home]="http://www.best4cn.com";        ##主页地址
$admin[password]="111";                ##管理员密码
$admin[email]="[email protected]";            ##管理员邮箱
$admin[name]="y10k";                ##管理员帐号
$admin[homename]="免费网络";            ##主页名称
$admin[ubb]=1;                    ##是否支持UBB代码,0=否
$admin[html]=0;                    ##是否支持HTML代码,0=否
$admin[up]="";                    ##留言簿上部HTML代码
$admin[down]="";                ##留言簿下部HTML代码
$admin[page]=5;                    ##每页默认显示留言数目
$admin[img]="image";                ##图片文件储存URL
$admin[gb]="http://2hu.net/free/gb/index.php";    ##留言簿主页主程序URL
####################################设置完成#############################################
if(empty($home))$home=$admin[home];
$pass=$admin[password];
if(empty(
$email))$email=$admin[email];
#########################################################################################
####################################公用函数#############################################
function oicq($uin){
 if(
$uin=="")return 1;else
 if(
strlen($uin)<=and !eregi("([^0-9])",$uin))return 1;else return 0;
}
function 
getline($file){
  
$data=Chop(fgets($file,5000));
  return 
$data;
}
function 
nowtime(){
  
$date=date("Y-m-d.G:i:s");
  return 
$date;
}
function 
getid(){
  
$id=date("YmdHis");
  return 
$id;
}
function 
ubb($Text) { 
  
$Text=htmlspecialchars($Text); 
  
$Text=ereg_replace("rn","<br>",$Text); 
  
$Text=ereg_replace("r","<br>",$Text); 
  
$Text=nl2br($Text); 
  
$Text=preg_replace("/\t/is","  ",$Text); 
  
$Text=preg_replace("/[h1](.+?)[/h1]/is","<h1>\1</h1>",$Text); 
  
$Text=preg_replace("/[h2](.+?)[/h2]/is","<h2>\1</h2>",$Text); 
  
$Text=preg_replace("/[h3](.+?)[/h3]/is","<h3>\1</h3>",$Text); 
  
$Text=preg_replace("/[h4](.+?)[/h4]/is","<h4>\1</h4>",$Text); 
  
$Text=preg_replace("/[h5](.+?)[/h5]/is","<h5>\1</h5>",$Text); 
  
$Text=preg_replace("/[h6](.+?)[/h6]/is","<h6>\1</h6>",$Text); 

  
$Text=preg_replace("/[url](http://.+?)[/url]/is","<a href=\1>\1</a>",$Text); 
  
$Text=preg_replace("/[url](.+?)[/url]/is","<a href="http://\1">http://\1</a>",$Text); 
  
$Text=preg_replace("/[url=(http://.+?)](.*)[/url]/is","<a href=\1>\2</a>",$Text); 
  
$Text=preg_replace("/[url=(.+?)](.*)[/url]/is","<a href=http://\1>\2</a>",$Text); 

  
$Text=preg_replace("/[img](.+?)[/img]/is","<img src=\1>",$Text); 
  
$Text=preg_replace("/[color=(.+?)](.+?)[/color]/is","<font color=\1>\2</font>",$Text); 
  
$Text=preg_replace("/[size=(.+?)](.+?)[/size]/is","<font size=\1>\2</font>",$Text); 
  
$Text=preg_replace("/[sup](.+?)[/sup]/is","<sup>\1</sup>",$Text); 
  
$Text=preg_replace("/[sub](.+?)[/sub]/is","<sub>\1</sub>",$Text); 
  
$Text=preg_replace("/[pre](.+?)[/pre]/is","<pre>\1</pre>",$Text); 
  
$Text=preg_replace("/[email](.+?)[/email]/is","<a href=\1>\1</a>",$Text); 
  
$Text=preg_replace("/[i](.+?)[/i]/is","<i>\1</i>",$Text); 
  
$Text=preg_replace("/[b](.+?)[/b]/is","<b>\1</b>",$Text); 
  
$Text=preg_replace("/[quote](.+?)[/quote]/is","<blockquote><font size='1' face='Courier New'>quote:</font><hr>\1<hr></blockquote>"$Text); 
   
$Text=preg_replace("/[code](.+?)[/code]/is","<blockquote><font size='1' face='Times New Roman'>code:</font><hr color='lightblue'><i>\1</i><hr color='lightblue'></blockquote>"$Text); 
   
$Text=preg_replace("/[sig](.+?)[/sig]/is","<div style='text-align: left; color: darkgreen; margin-left: 5%'><br><br>--------------------------<br>\1<br>--------------------------</div>"$Text); 
return 
$Text

function 
str($msg){
  global 
$admin;
  if(!
$admin[html]) $msg=htmlspecialchars($msg);
  if(
$admin[ubb]) $msg=ubb($msg);
  
$msg=nl2br($msg); #处理message
  
$msgstr_replace("n","",$msg); #处理message
  
$msgstr_replace("r","",$msg); #处理message
  
return $msg;
}
function 
error($msg){
global 
$admin;
?>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="<?echo$admin[img];?>/style.css"><title>留言簿出错</title></head><body bgcolor="#ffffff">
<html><head></head><body bgcolor="#FFFFFF"><center><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr><td width="100%"><table border="0" width="100%" bgcolor="#000000" cellspacing="0" cellpadding="0">
<tr><td width="100%"><table border="0" cellspacing="1" width="100%" align=left height="320">
<tr><td width="100%" bgcolor="#FFB500" align=center height="31"><font color="#804000"><span style="font-size: 11pt">留言本发生错误</span></font></td>
</tr><tr><td width="100%" align=left height="247" bgcolor="#F7F7F7"><span style="font-size: 11pt"><p align="center">
出错原因:<font color="#FF0000"><? echo $msg;?></font></p><p align="center"><a href="javascript:history.go(-1);"><font color="#000000">请点这里返回上一页检查你的输入是否有误</font></a></p>
<p align="center">[ <a href="javascript:history.go(-1);">返回上一页</a> ]</p></span></td></tr><tr><td width="100%" bgcolor="#FFB500" height="30"><p align="right"><span  
style="font-size: 9pt"><font color="#804000">Copyright 200x y10k </font><font face="Arial" color="#804000">.Allrights reserved.</font></span></td>  
</tr></table></td></tr></table></td></tr></table></center></body></html>
<?
}
function 
output($line,$no){
$info=explode("|!:!|",$line);
global 
$name;
global 
$admin;
global 
$user;
?>
<center><TABLE a bgColor=#000000 border=0 cellPadding=0 cellSpacing=0 height=1 width='90%'>
<TR bgColor=#ffffff width="100%"><TD bgColor=#000000 height=1 width="100%">
<TABLE border=0 cellPadding=3 cellSpacing=1 height=8 width="100%"><TBODY><TR>
<TD bgColor=#f7f7f7 height=8 rowSpan=3 vAlign=top width=155>
<TABLE><font color="#000000">留言:NO.<?echo$no;?></font>
<TBODY></TBODY></TABLE><div align="center"><center><TABLE border=0 cellPadding=0 cellSpacing=0>
<TBODY><TR><TD align=middle><font color="#000000"><img src="<?echo$info[3];?>" width="32" height="32"></font></TD></TR></TBODY></TABLE></center></div>
<P>姓名:<font color="#000000"><?echo$info[2];?></font><BR>来自:<font color="#000000"><?echo$info[7];?></font><BR>邮件:<a href="mailto:<?echo$info[4];?>" title="给<?echo$info[2];?>发信"><IMG border=0 src="<?echo$admin[img];?>/mail.gif">&nbsp;邮件</a><BR>主页:<a href="<?echo$info[5];?>" target="_blank" title="访问<?echo$info[2];?>的主页"><IMG border=0 src="<?echo$admin[img];?>/home.gif">&nbsp;主页</a> <BR></P></TD>
<TD bgColor=#ffffff height=1 width=503><IMG src="<?echo$admin[img];?>/1.gif" width="18" height="18"> 发表于:<?echo$info[8];?> 
<TR><TD bgColor=#ffffff height=95 width=503><TABLE border=0 cellPadding=3 cellSpacing=0 height="100%" width="100%"><TBODY><TR><TD vAlign=top width="100%" height="94"><font color="#0080FF"><?echo$info[1];?></font></TD></TR></TBODY></TABLE><TR>
<TD bgColor=#f7f7f7 height=10 width=503>&nbsp; <a href="mailto:<?echo$info[4];?>" title="给<?echo$info[2];?>发信"><IMG border=0 src="<?echo$admin[img];?>/mail.gif">&nbsp;邮件</a>&nbsp; <a href="<?echo$info[5];?>" target="_blank" title="访问<?echo$info[2];?>的主页"><IMG border=0 src="<?echo$admin[img];?>/home.gif">&nbsp;主页</a>&nbsp; <img src=http://infocenter.tencent.com/<?echo$info[6];?>/s/ alt=<?echo$info[2];?>的OICQ:<?echo$info[6];?> width=16 height=16>&nbsp;OICQ&nbsp;<IMG alt=<?echo$info[2];?>的IP地址是:<?echo$info[7];?> border=0 src="<?echo$admin[img];?>/ip.gif" width="13" height="15">&nbsp;IP
&nbsp;<a href="<?echo$PHP_SELF;?>?action=reply&user=<?echo$user;?>&id=<?echo$info[0];?>" title="回复该留言(只有版主才有回复的权利!)"><IMG border=0 src="<?echo$admin[img];?>/replay.gif">&nbsp;回复</a>
&nbsp;<a href="<?echo$PHP_SELF;?>?action=del&user=<?echo$user;?>&id=<?echo$info[0];?>" title="删除该留言"><IMG border=0 src="<?echo$admin[img];?>/del.gif">&nbsp;删除</a></TD></TR></TBODY></TABLE></TR></TABLE></CENTER>
<?
}
####################################函数完成#############################################
#########################################################################################
####################################程序部分#############################################
if(empty($user))$user="main";
$file="$admin[path]/$user.dat";
if(!
file_exists($file)) error("对不起,没有找到这个用户的留言簿,<a href=$PHP_SELF>不如您申请一个吧</a>!");
else{
if(
$user<>"main") include("$admin[path]/$user.php");
if(
$action=="add"){
if(
$addsub){
  
$name=Chop($name);
  
$msg=str($msg);
  if(
$msg=="" or $name=="")error("不是吧,你的名字和留言都不写,还叫做什么“留言”啊!");
  elseif(!
oicq($oicq))error("你的OICQ好像有错啊!");
  else{
    if(
$sex=="boy")$sex="$admin[img]/01.gif";
       else 
$sex="$admin[img]/02.gif";
    if(
$oicq=="")$oicq="未知";
    if(
$home=="")$home="未知";
    if(
$mail=="")$mail="未知";
    
$data=fopen("$admin[path]/$user.dat","r");
    
$num=Chop(fgets($data,15));
    
$num++;
    
$old=fread($data,filesize($file));
    
fclose($data);
    
$id=getid();
    
$time=nowtime();
    
$ip=$REMOTE_ADDR;$ip2=explode(".",$ip);$ip="$ip2[0].$ip2[1].$ip2[2].xxx";
    
$writemsg="$numn$id|!:!|$msg|!:!|$name|!:!|$sex|!:!|$email|!:!|$home|!:!|$oicq|!:!|$ip|!:!|$timen$old";
    
$data=fopen($file,"w");
    
fwrite($data,$writemsg);
    
fclose($data);
    
$cookietime=time()+31536000;
    
setcookie(ex_user_home,$home,$cookietime);
    
setcookie(ex_user_mail,$email,$cookietime);
    
setcookie(ex_user_name,$name,$cookietime);
    
setcookie(ex_user_oicq,$oicq,$cookietime);
    echo 
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";
    
echo "<HTML><HEAD><TITLE>发表文章</TITLE>";
    echo 
"<META content="text/htmlcharset=gb2312" http-equiv=Content-Type>";
    echo 
"<link rel="stylesheet" href="$admin[img]/style.css">";
    echo 
"<meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=$PHP_SELF?user=$user">";
    echo 
"</head><body topmargin="0"><br>";
    echo 
"<ul>谢谢你发表留言,即将返回留言簿首页.<br>";
    echo 
"&nbsp;<br>请等待 系统正在创建这个新的留言...<br>";
    echo 
"&nbsp;<br></font>";
    echo 
"<a href=$PHP_SELF?user=$user>如果你的浏览器没有自动的返回到留言簿首页,或者你不想再等待,请点这里返回.";
    echo 
"</font></a></ul>";
  }}else{
if(
$ex_user_home=="")$ex_user_home="http://";
?>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="<?echo$admin[img];?>/style.css"><title>签写留言</title></head>
<body bgcolor="#ffffff"><table align="center"><tr><td>
<form method="POST" action="<? echo $PHP_SELF;?>?action=add" align="center">
<center><table border="0" width="85%" height="43" bgcolor="#000000" cellspacing="1"><tr><td width="732" height="25" colspan="2" bgcolor="#336699"> 
<p align="center"><center><a href="<? echo $PHP_SELF;?>?action=add"><font color="#F7F7F7">签写留言</font></a></center></td></tr><tr align="center"><td width="238" valign="middle" align="center" height="1" bgcolor="#FFFFFF"><p align="center"><font color="#000000">您的名字:</font></td> 
<td width="232" valign="middle" align="left" height="1" bgcolor="#FFFFFF"><font color="#000000">&nbsp;<input type="text" name="name" size="35" maxlength="50" class="stedit" value="<?echo$ex_user_name;?>"> 
</font></td></tr><tr align="center"><td width="238" valign="middle" align="center" height="23" bgcolor="#FFFFFF"> 
<p align="center"><font color="#000000">您的OICQ:</font>
</td><td width="232" valign="middle" align="left" height="23" bgcolor="#FFFFFF"><font color="#000000">&nbsp;<input type="text" name="oicq" 
size="35" maxlength="50" class="stedit" value="<?echo$ex_user_oicq;?>"></font></td></tr><tr align="center"><td width="238" valign="middle" height="25" bgcolor="#FFFFFF" align="left">
<p align="center"><font color="#000000">电子邮件:</font></td><td width="644" valign="middle" align="left" height="25" bgcolor="#FFFFFF">
<font color="#000000">&nbsp;<input type="text" name="email" size="35" maxlength="30" class="stedit" value="<?echo$ex_user_mail;?>"></font></td></tr><tr>
<td width="238" valign="middle" height="21" bgcolor="#FFFFFF" align="left"><p align="center"><font color="#000000">主页地址:</font></p>
</td><td width="644" valign="middle" align="left" height="21" bgcolor="#FFFFFF"><font color="#000000">&nbsp;<input type="text" name="home" size="35" maxlength="50" class="stedit" value="<?echo$ex_user_home;?>"></font></td></tr>
<tr><td width="238" valign="middle" height="23" bgcolor="#FFFFFF" align="left"><p align="center"><font color="#000000">您的性别:</font></p></td><td width="644" valign="middle" align="left" height="23" bgcolor="#FFFFFF">&nbsp; 
<select size="1" name="sex"><option value="boy" selected>帅&nbsp;&nbsp; 哥</option><option value="girl">美&nbsp;&nbsp; 女</option></select></td>
</tr><tr align="center"><td width="238" valign="middle" align="left" height="1" bgcolor="#FFFFFF"><p align="center"><font color="#000000">留言内容</font></td><td width="644" valign="middle" align="left" height="1" bgcolor="#FFFFFF"><font color="#000000">
<textarea rows="7" name="msg" cols="69" class="stedit"></textarea><input type="hidden" name="user" value="<? echo $user;?>">
</font></td></tr><tr align="center"><td width="732" valign="middle" align="center" height="6" colspan="2" bgcolor="#336699"><font color="#000000"><input type="submit" value="签写留言" name="addsub" class="stbtm">&nbsp;&nbsp;&nbsp;&nbsp; 
<input type="reset" value="重新来过" name="B2" class="stbtm"></font></td></tr></table></center></form></td></tr></table><hr width="80%" noshade size="1" color="#000000"><p align="center">免费留言本由<font color=#cc0033></font><font color=#ff6633><b><font Helvetica, sans-serif><a href="<?echo$admin[home];?>" target=_blank><? echo$admin[homename];?></a></font></b></font><font color=#cc0033></font>提供 技术支持:<b><a href=http://www.best4cn.com target=_blank>y10k</a></b></p></body>
<?
}
}elseif(
$action=="del"){
if(
$delsub){
if(
$password==$pass){
  echo 
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";
  
echo "<HTML><HEAD><TITLE>发表文章</TITLE>";
    echo 
"<META content="text/htmlcharset=gb2312" http-equiv=Content-Type>";
    echo 
"<link rel="stylesheet" href="$admin[img]/style.css">";
    echo 
"<meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=$PHP_SELF?user=$user">";
    echo 
"</head><body topmargin="0"><br>";
    echo 
"<ul>斑竹删除留言成功.<br>";
    echo 
"&nbsp;<br>请等待 系统正在删除这个留言...<br>";
    echo 
"&nbsp;<br></font>";
    echo 
"<a href=$PHP_SELF?user=$user>如果你的浏览器没有自动的返回到留言簿首页,或者你不想再等待,请点这里返回.";
    echo 
"</font></a></ul>";
  
flush();
  
$file="$admin[path]/$user.dat";
  
$data=fopen($file,"r");
  
$num=chop(fgets($data,15));
  
$num--;
  
$headdata="";$sign=1;$id="$id";
  While(
$sign){
      
$headdata=$headdata.$temp;
    
$temp=fgets($data,1000);
    
$line=explode("|!:!|",$temp);
    if(
$line[0]==$id$sign=0;
    if(
feof($data)){error("没有找到留言。留言簿出错"); exit;}
  }
  
$footdata=fread($data,filesize($file));
  
fclose($data);
  
$writemsg=$num."n".$headdata.$footdata;
  
$data=fopen($file,"w");
  
fwrite($data,$writemsg);
  
fclose($data);
}else 
error("呵呵,你的密码错啦,你看来不是斑竹,不能删除留言!");
}else{
?>
<html><head><meta http-equiv="Content-Type" content="text/html;charset=gb2312"><title>斑竹删除留言</title><link rel="stylesheet" href="<?echo$admin[img];?>/style.css"></head><body bgcolor="#ffffff"><form method="post" action="<?echo$PHP_SELF;?>?action=del"><center><table width=90% border=0 cellspacing="1" bgcolor="#000000"><tr align=center><td align=center colspan=4 width=652 bgcolor="#336699"><p><font color="#FFFFFF">留言本管理</font></td></tr><tr align=center><td align=center width=18% bgcolor="#F7F7F7"><p align="center">版主账号:</p></td> <td align=center bgcolor="#F7F7F7" width="32%">&nbsp;&nbsp;&nbsp; <input type=text name=name size=20 class="stedit"></td><td align=center bgcolor="#F7F7F7" width="18%">版主密码:</td><td align=center bgcolor="#F7F7F7" width="32%"><input type=password name=password size=20 class="stedit"><input type="hidden" name="user" value="<? echo $user;?>"><input type="hidden" name="id" value="<? echo $id;?>"></td></tr><tr align="center"><td align="center" colspan="4" width="652" bgcolor="#F7F7F7"><div align="center"><p><input type="submit" name="delsub" value="确认删除" class="stbtm">&nbsp;&nbsp;&nbsp;<input type="reset" value="重新来过" name="B1" class="stbtm"></td></tr></table></body></html>
<?
}}elseif($action=="reply"){
if(
$replysub){
if(
$password==$pass){
  echo 
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";
  
echo "<HTML><HEAD><TITLE>发表文章</TITLE>";
    echo 
"<META content="text/htmlcharset=gb2312" http-equiv=Content-Type>";
    echo 
"<link rel="stylesheet" href="$admin[img]/style.css">";
    echo 
"<meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=$PHP_SELF?user=$user">";
    echo 
"</head><body topmargin="0"><br>";
    echo 
"<ul>斑竹添加回复成功.<br>";
    echo 
"&nbsp;<br>请等待 系统正在添加这个留言的回复...<br>";
    echo 
"&nbsp;<br></font>";
    echo 
"<a href=$PHP_SELF?user=$user>如果你的浏览器没有自动的返回到留言簿首页,或者你不想再等待,请点这里返回.";
    echo 
"</font></a></ul>";
  
flush();
  
$file="$admin[path]/$user.dat";
  
$data=fopen($file,"r");
  
$headdata="";$sign=1;$id="$id";
  While(
$sign){
      
$headdata=$headdata.$temp;
    
$temp=fgets($data,1000);
    
$line=explode("|!:!|",$temp);
    if(
$line[0]==$id$sign=0;
    if(
feof($data)){error("没有找到留言。留言簿出错"); exit;}
  }
  
$msg=str($msg);
  
$line[1]=$line[1]."<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#FF0000>斑竹回复:</font><font color=#000099>$msg</font>";
  
$temp2=implode("|!:!|",$line);
  
$footdata=fread($data,filesize($file));
  
fclose($data);
  
$writemsg=$headdata.$temp2.$footdata;
  
$data=fopen($file,"w");
  
fwrite($data,$writemsg);
  
fclose($data);
}else 
error("呵呵,你的密码错啦,你看来不是斑竹,不能回复留言!");
}else{
?>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>回复留言</title><link rel="stylesheet" href="<?echo$admin[img];?>/style.css"></head><body bgcolor="#ffffff"><form method="post" action="<?echo"$PHP_SELF?&user=$user&id=$id";?>&action=reply"><center><table width=90% border=0 cellspacing="1" bgcolor="#000000" height="1"><tr align=center><td align=center colspan=4 width=652 bgcolor="#336699" height="18"><p><font color="#FFFFFF">留言本管理</font></td></tr><tr><td align=center width=18% bgcolor="#F7F7F7" height="25"><p align="center">版主账号:</p></td> <td align=center bgcolor="#F7F7F7" width="32%" height="25">&nbsp;&nbsp;&nbsp; <input type=text name=adminame size=20 class="stedit"></td><td align=center bgcolor="#F7F7F7" width="18%" height="25">版主密码:</td><td align=center bgcolor="#F7F7F7" width="32%" height="25"><input type=password name=password size=20 class="stedit"></td></tr><tr><td align=center width=100% bgcolor="#F7F7F7" colspan="4" height="1">回复内容:</td></tr><tr align=center><td align=center width=100% bgcolor="#F7F7F7" colspan="4" height="119"><textarea rows="6" name="msg" cols="87"></textarea></td> </tr><tr align="center"><td align="center" colspan="4" width="652" bgcolor="#F7F7F7" height="27"><div align="center"><p><input type="submit" value="确认回复" class="stbtm" name="replysub">&nbsp;&nbsp;&nbsp;<input type="reset" value="重新来过" name="B1" class="stbtm"></td></tr></table>
<?
}
}elseif(
$searchsub or $action=="search"){
if(
$keyword=="")error("怎么不写关键字?");
else{
?>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="<?echo$admin[img];?>/style.css"><title><?echo$title;?></title></head>
<body bgcolor="#ffffff"><table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr><td width="100%"><p align="center"><img border="0" src="<?echo$admin[img];?>/logo.gif" width="400" height="40" alt="<?echo$title;?>"></td>
</tr></table><table border="0" width="100%" cellpadding="2" height="12"><tr>
<td width="100%" height="6"><p align="center"><font color="#2F5E8C">[</font><a href="<?echo$PHP_SELF;?>?action=add&user=<?echo$user;?>"><font color="#008000">签写留言</font></a><font color="#2F5E8C">]  
[</font><a href="<?echo$home;?>"><font color="#008000">返回首页</font></a><font color="#2F5E8C">]  
[</font><a href="mailto:<?echo$email;?>"><font color="#008000">版主信箱</font></a><font color="#2F5E8C">]  
[</font><a href="<?echo$PHP_SELF;?>?action=reg"><font color="#008000">免费申请</font></a><font color="#2F5E8C">]  
[</font><a href="<?echo$PHP_SELF;?>?action=modify&user=<?echo$user;?>"><font color="#008000">修改资料</font></a><font color="#2F5E8C">]  
[</font><a href="<?echo$PHP_SELF;?>?action=admin"><font color="#008000">超级管理</font></a><font color="#2F5E8C">]  
[</font><a href="<?echo$admin[img];?>/help.html"><font color="#008000">使用帮助</font></a><font color="#2F5E8C">]</font></td>
</tr><tr><form method="POST" action="<?echo$PHP_SELF;?>?action=search&user=<?echo$user;?>"><td width="100%" height="6">
<p align="center">关键字:<input size="20" class="stedit" name="keyword">&nbsp;&nbsp;&nbsp;<input name="searchsub" type="submit" value="留言搜索" class="stbtm"></p></td></form></tr></table>
<div align="center"><?echo$admin[up];?><?echo$up;?></div>
<TABLE bgColor=#000000 border=0 cellPadding=0 cellSpacing=0 width="90%" align="center" height="8">
<CENTER></center><TR bgColor=#ffffff><TD bgColor=#000000><TABLE border=0 cellPadding=3 cellSpacing=1 height=8 width="100%"><CENTER></center><TR><CENTER>
<TD bgColor=#2f5e8c height=19 width=155><font color="#ffffff">&nbsp;作者信息</font></TD>
</center><TD bgColor=#2f5e8c height=19 width=503> 
<p align="left"><font color="#ffff00">&nbsp;留言内容</font></p></TD>
</TR></TABLE></TR></TABLE>
<!-- Start -->
<?
  flush
();
  if(empty(
$page))$page=1;
  
$start=($page-1)*$admin[page]+1#得到起始帖子
  
$list=fopen($admin[path]."/$user.dat","r");
  if(
$page!=and $page!=0){
    
$i=0;
    while(
$i<=$start and !(feof($list))){
        
$line=getline($list);
        if(
strpos($line,$keyword)){
          
$i++;
        }
    }
  }
  
$i=0;
  while(
$i<=$admin[page] and !(feof($list))){
    
$line=getline($list);
    if(
strpos($line,$keyword)){
    if(
$line!="")  output($line,$i);
    
$i++;
    }
  }
  
fclose($list);
?>
<!-- ended -->
<table border="0" width="100%" height="1" cellpadding="0">  
<tr><td width="100%" height="1"><p align="center"><font color="#004080">&nbsp;<br>
页数:&nbsp;
<?
    $j
=$page-1;
    echo 
"||<a href=$PHP_SELF?user=$user&page=$j&action=search&keyword=$keyword><font color = #8080FF>上一页</font></a>||";
    
$j=$page+1;
    echo 
"<a href=$PHP_SELF?user=$user&page=$j&action=search&keyword=$keyword><font color = #8080FF>下一页</font></a>||";
}
?>
</font></td></tr></table><HR noShade SIZE=1 width="80%" color="#000000"><div align="center"><center>
<div align="center"><?echo$admin[down];?><?echo$down;?></div>
<TABLE border=0 cellSpacing=4 width=545><TBODY><TR align=middle><TD class=unnamed1 width=533>
<P align=center>免费留言本由<FONT color=#cc0033> </FONT><FONT color=#ff6633><B><FONT sans-serif Helvetica,><A href="<?echo$admin[home];?>" target=_blank><?echo$admin[homename];?></A></FONT></B></FONT><FONT color=#cc0033> </FONT>提供   
技术支持:<B><A href="http://www.best4cn.com/" target=_blank>y10k</A></B></P></TD></TR></TBODY></TABLE></center></div>
</body></html>
<?
.......................