addnote.php
添加留言
。
if (!$name||!$email||!$title||!$nnote){ //检查是否填写完整
echo "对不起,您必须填所有内容!
"."
返回";
exit; }elseif(!ereg('^[-!#$%&'*+./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+.'.'[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+$',$email) //email合法性验证
){
echo "email不合法!
"."
返回";
exit;
}
//写入数据库
$sql="INSERT INTO notebook (name,email,time,face,ip,title,nnote) VALUES ('$name','$email','$time','$face','$ip','$title','$nnote')";
$result = mysql_query($sql,$db);
mysql_close($db);
echo "留言成功!";
}
?>
delnote.php
";
echo "
请输入管理员密码
";
echo "管理员";
echo "
";
echo "密码";
echo "
";
echo "
";
echo "
";
echo "";
exit;
}
if($del==1){ //判断是否要删除
mysql_query("delete from notebook where time='$time'",$db); //以留言时间为删除标志
echo "删除成功!";
}
?>
删除留言
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);
?>
|
";
echo " | ";
echo "留言人:$name | ";
echo "发表于:$time | ";
echo " | ";
echo " $ip |
";
echo "标题:$title |
";
echo "留言内容:$nnote |
";
}
mysql_close($db);
?>