php code 首先,我们先确定,留言的几个过程:写留言,发送,查看.(搜索)等等.而且对于斑竹来说,管理留言本又是不可或缺的.这样我们就不妨定位于6个php文件,1个文本文件.6个php文件分别为:guest.php manage.php reply.php sys.php del.php edit.php,1个文本文件为:guest.txt先来看看guest.php的内容,你当然可以直接将下面的内容放到您的php网页里,请尊重作者的劳动,谢谢.----------------------//guest.php:require(sys.php);if ($b1){ if ($message== or $name==) { $errorm=出错了!!!姓名和留言内容必填; } else{#写入数据$space = ;$time = date(y年m月d日h小时i分);$ip=$remote_addr;$name=encode($name);$homepage=encode($homepage);$from=encode($from);$email=encode($email);$message=stripslashes($message);$message=htmlspecialchars($message);$message=check_strlen_long($message);$message=nl2br($message);$guestcontent = 留言内容:
include('head.htm');?> if ($errorm) { echo ; echo ; echo $errorm; echo ; echo
; } ?> 姓名(必填)
主页:
来自:
email:
请留言(必填)
管理密码:
请输入关键字:
function search($keyword) { global $content; $count=count($content); $subscript=0; $arrsearch=array(); for ($i=0;$i$keyword,$content[$i]); $subscript++; } } return $arrsearch; }//end function $one_page_line=15; $content = file($guestfile); if (isset($search) and isset($keyword) and $keyword!=) { $content=search($keyword); } $count =count($content); ?> $int_page_count=$count;//总条数; $int_page_num=ceil($int_page_count/$one_page_line);//总页数; echo 分页:; for ($i=1;$i.$i. ; } echo ; if (isset($search) and isset($keyword) and $keyword!=) { echo
; echo 下面的留言中包含关键字$keyword共.$count.条; } ?> 共有条
if ($page== or !isset($page)) {$page=1;} $text=; $begin_line=$int_page_count-($page-1)*$one_page_line; if ($begin_line($begin_line-$one_page_line);$j--) { $text=$text.回复 编辑 删除 第$j条
; $text.=$content[$j-1]; //数组找下标从0开始. } echo $text;?>
include('bottom.htm');?>