php留言板

推荐一些比较好的php留言板程序
有没有那种 涂鸦留言板呢?

第1个回答  2009-10-07
我给你一个我自己做的留言板的代码吧,你只需创建数据库,把代码复制过去即可使用。如下:
创建数据库:
create database stud;
use stud;
create table student(username char(20) not null,message char(200) not null);
PHP代码:
文件index.html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>留言板</title>
</head>

<body>
<SCRIPT LANGUAGE="javascript">
<!--
function openwin(){
window.open ('message.html', '添加留言', 'height=400, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
return flase;
}
-->
</SCRIPT>
<a href="#" onclick="openwin()">我要留言</a>
<a href="show.php">查看留言</a>
</body>
</html>
文件message.html
<title>留言板</title>
</head>

<body>
<form id="form1" name="form1" method="POST" action="post.php">
<label>姓名
<input type="text" name="username" />
</label>
<p>
<label>留言
<textarea rows="5" name="message" ></textarea>
</label>
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
<label>
<input type="reset" name="Submit2" value="重置" />
</label>
</p>
</form>
</body>
</html>
文件post.php
<?php
$link=mysql_connect('localhost','root','123456');
mysql_select_db('stud',$link);
mysql_query("set names 'gb2312' ");
if($_POST['Submit'])
$query="INSERT INTO student(username,message)VALUES('$_POST[username]','$_POST[message]')";
if(mysql_query($query))
{echo"提交成功";
header("location:index.html");}
else
{echo"提交不成功";}
?>
文件show.php
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>结果</title>
</head>

<body>
<?php
$link=mysql_connect('localhost','root','123456');
mysql_select_db('stud',$link);
mysql_query("set names 'gb2312' ");
$result=mysql_query("select*from student",$link);
$count=mysql_num_rows($result);
$all=$count-1;
?>
<table width="418" border="1" align="center">
<tr align="center">
<td width="130"> <?php echo"用户名" ?> </td>
<td width="280"> <?php echo"留言内容" ?> </td>
</tr>
<?php
while($row=mysql_fetch_array($result))
{
?>
<tr align="center">
<td width="130"> <?php echo$row[username] ?> </td>
<td width="280"> <?php echo$row[message] ?> </td>
</tr>
<?php
}
?>
</table>
一共有<?php echo$all+1; ?>条留言<a href="index.html">返回首页</a>

</body>
</html>
代码完毕!!
第2个回答  2009-10-07
留言板去这选一个:
http://www.codefans.net/sort/list_2_34_1.shtml本回答被提问者采纳
第3个回答  2009-10-07
留言板自有留言板的好处,体积小巧配置方便,还是自己写的好,也没多少代码的
第4个回答  2009-10-07
你直接架一个PHP论坛不就德了吗
留言板 必定还是不安全
漏洞太多了
第5个回答  2009-10-07
php100去看下