时间:2021-07-01 10:21:17 帮助过:28人阅读
共有留言:$rowcount 条 共:$PAGES 页 | ";
姓 名 | $myrow[username] |
电子信箱 | $myrow[email] |
公司主页 | $myrow[homepage] |
留言主题 | $myrow[topic] |
留言内容 | $myrow[content] |
留言时间 | $myrow[date] |
"; #判断是否有上一页或下一页(10行换页) echo ""; echo " | ";
返回继续发言 |
返回";
}
//wrong homepage ?
elseif (($homepage!="")and(!eregi("(http://) [0-9a-z-] .([0-9a-z-] .) [a-z]{2,3}$",$homepage)))
{echo "主页地址输入错误!返回";}
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"对不起!请先注册!";
}
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 "谢谢您留言!您的留言已成功加入,返回";
}
}
?>
3.zhuc.php(注册程序)
mysql_connect("localhost","root","")
or die("无法连接数据库,请重试");
mysql_select_db("lyanban")
or die("无法选择数据库,请重试");
$query="select password from tb where username='$username'";
$result=mysql_query($query);
$numrows=mysql_num_rows($result);
if($numrows!=0)
{echo '已有人注册此名,请重新选择名字!返回';}
else
{$query="insert into tb(username,password) values('$username','$password')";
mysql_query($query);
echo '注册成功';
echo '请登录!';}
?>
以下是两个配套的HTML:
1。留言网页
用户注册