【 tulaoshi.com - PHP 】
                             
                               特点: 
支持oicq头像,自动分页,显示留言人ip,email合法性验证,方便安全的留言管理, 
没有复杂函数,初学者也很容易看懂。 
程序示例:http://medguider.51.net/notebook/ 
完整程序下载(包括图片)http://medguider.51.net/download/notebook.zip 
程序清单: 
config.php 配置文件 mysql.txt 数据库文件 index.php 显示留言主程序 addnote.php 添加留言 delnote.php 删除留言 
mysql.txt 
create table notebook (name char(6),email varchar(35),time char(30),face char(2),ip varchar(16),title varchar(255),nnote text); 
//留言簿 name 姓名 email time 时间 face 头像 ip title 标题 nnote 内容 
config.php 
<?php 
//这里改为自己的数据库用户名与密码 
$db = mysql_connect("localhost", "root"); 
mysql_select_db("test",$db); 
//这里改为自己的管理用户名和密码 
$username="demo"; 
$password="demo"; 
? 
index.php 
<HTML 
<HEAD 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" 
<TITLE留言簿</TITLE 
<style type="text/css" 
<!-- 
.blue9 {  font-size: 9pt; color: #0099FF; text-decoration: none} 
.black9 {  font-size: 9pt; text-decoration: none} 
.purple10 {  font-size: 10pt; color: #9900FF; text-decoration: none} 
.white12 {  font-size: 12pt; color: #FFFFFF; text-decoration: none} 
a:visited {  color: #FFFFFF} 
a:link {  color: #FFFFFF} 
-- 
</style 
</HEAD 
<BODY BGCOLOR="#FFFFFF" 
<?php 
 include ("config.php"); 
 $result = mysql_query("SELECT * FROM notebook ",$db); 
 $row=mysql_num_rows($result);//查看查询结果有多少行 
 $max=$row; //帖子总数 
 //设每页显示10篇,可自行设定,$p总页数,$page第几页,$low 从第几行开始读,$x 读取几行 
 if (!$page){ $page=1;}//$page默认值为1 
 $p=ceil($max/10);//页数为$max/10的最大整数 
 $low=10*($page-1); 
 if($page==$p&&($max%10)<0){$x=($max%10);} else {$x=10;}//如果是最后一页,且不是10的整倍数,读取$max除以10的余数,否则取10 
 if($max==0){$x=0;}//如果没有帖子,$x取0 
 $result = mysql_query("select * from notebook ORDER BY time DESC limit $low,$x",$db);//按照帖子的时间降序查询 
 ? 
<table width="98%" border="0" cellspacing="0" cellpadding="0" height="61" 
  <tr  
    <td height="62" width="34%"<a href="http://www.medguider.com"<img src="http://img.jcwcn.com/attachment/portal/jcwcj/2005-12/10/05121010241511414.gif"" width="243" height="60" alt="医学导航网" border="0"</a</td 
    <td height="62" width="66%"  
      <div align="center"<img src="http://img.jcwcn.com/attachment/portal/jcwcj/2005-12/10/05121010241565444.gif"" width="410" height="60"<img src="http://img.jcwcn.com/attachment/portal/jcwcj/2005-12/10/05121010241543418.gif"" width="60" height="60"</div 
    </td 
  </tr 
</table 
<table width="95%" border="1" cellspacing="0" cellpadding="0" height="253" bordercolordark="#FFFFFF" bordercolorlight="#003399" align="center" 
  <tr  
    <td height="250"  
      <div align="center"</div 
      <table width="95%" border="0" cellspacing="0" cellpadding="0" height="32" bgcolor="#3366FF"