|
1.guestbook.php(留言程序)
天地网络留言版
[B]共有留言:$rowcount 条 共:$PAGES 页 现在是第 $AA 页[/B][/td]";
echo "";
while ($myrow=mysql_fetch_array($result)){
$i++;
if(($i>=$rownum)&&($i
[color=]姓 名
[/td][td]
[color=]$myrow[username]
[/td][/tr]";
echo "[tr][td]
[color=]电子信箱
[/td][td][url=]$myrow[email][/url][/td][/tr]";
echo "[tr][td]
[color=]公司主页
[/td][td][url=]$myrow[homepage][/url][/td][/tr]";
echo "[tr][td]
[color=]留言主题
[/td][td]
[color=]$myrow[topic]
[/td][/tr]";
echo "[tr][td]
[color=]留言内容
[/td][td]
[color=]$myrow[content]
[/td][/tr]";
echo "[tr][td]
[color=]留言时间
[/td][td]
[color=]$myrow[date]
[/td][/tr]";
echo "[/table]";}
}
echo "";
#判断是否有上一页或下一页(10行换页)
echo "";
echo "";
echo "";
#显示上一页
if ($rownum>=5)
echo "";
#显示下一页
if ($rownum+5";
}
echo "";
echo "[/td]";
echo "[/tr]";
echo " | ";
echo "";
?>
2.show.php3(显示程序)
?
$username = htmlspecialchars(ltrim(stripslashes (trim($name))));// 本函式可去掉字串中的反斜线空格字元
$email = htmlspecialchars(ltrim(stripslashes (trim($email))));
$homepage = htmlspecialchars(ltrim(stripslashes (trim($homepage))));
$topic = htmlspecialchars(ltrim(stripslashes (trim($topic))));
$content = htmlspecialchars(ltrim(stripslashes (trim($content))));
// $content=base64_encode($content);
//send email
// if ($ok) mail($email,$topic,$content);
if (($username=="")or($topic=="")or(strlen($username)>20)or(strlen($topic)>20))
{echo "请填写必要的项目或着非法用户名![url=]返回[/url]";
}
//wrong email ?
elseif (($email!="")and(!eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$",$email)))
{
echo "请您填写正确的 E-Mail 地址
[url=]返回[/url]";
}
//wrong homepage ?
elseif (($homepage!="")and(!eregi("(http://)+[0-9a-z-]+.([0-9a-z-]+.)+[a-z]{2,3}$",$homepage)))
{echo "主页地址输入错误![url=]返回[/url]";}
else{
//联接数据库
mysql_connect("localhost","root","");
mysql_select_db("lyanban");
$sql="select password from tb where username='$username'";
$result=mysql_query($sql);
$nums=mysql_num_rows($result);
if($nums!=1){
echo"对不起!请先[url=]注册[/url]!";
}
else{
//得到日期 YYYY-MM-DD HH:MM:SS 2000-01-01 00:00:00'
$t = date(Y."-".m."-".d." ".H.":".i.":".s);
//将新用户插入数据库
mysql_query("insert into message values ('$username','$email','$homepage','$topic','$content','$t')");
echo "谢谢您留言!您的留言已成功加入,[url=]返回[/url]";
}
}
?>
3.zhuc.php(注册程序)
以下是两个配套的HTML:
1。留言网页
天地网络留言版欢迎您留言!
天地网络留言版测试版
您的尊姓大名:
|
|
您的电子邮件地址:
|
|
您的公司主页地址:
|
|
留言主题:
|
|
留言内容:
|
|
|
|
|
|
|
2.注册程序
registe
用户注册
用户名:
密码:
如需要ZIP文件可给我来信。tandinet@163.net
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
|
|