【php开源代码栏目提醒】:网学会员为需要php开源代码的朋友们搜集整理了add.php相关资料,希望对各位网友有所帮助!
<?
if ($title=="") error("要输入主题啦,不然不让你过唷",$k);
if ($username=="") error("请问贵姓大名?",$k);
if ($comment=="") error("想在这边聊什麽呢?",$k);
if ($home == "http://") {
$home="";
}
if ($email != "") {
if (!preg_match("/.*\@.*\..*/",$email)) error("E-MAIL不正确",$k);
}
if ($home != "") {
if (!preg_match("/^http:\/\/[\w\W]+\.[\w\W]+$/",$home)) error("网址不正确",$k);
}
if ($cookie_name == "") {
SetCookie("cookie_name","$username");
}
if ($cookie_home == "") {
SetCookie("cookie_home","$home");
}
if ($cookie_email == "") {
SetCookie("cookie_email","$email");
}
$comment=str_replace("\n","<br>\n",$comment);
$sql="INSERT INTO
bbs_form (title,username,comment,email,home,click,lastdate,replydate,userip) VALUES ('$title','$username','$comment','$email','$home','0','$time','$time','$ip')";
@
mysql_query($
sql)||error("<head><link rel=\"stylesheet\" href=\"2col_rightNav.css\" type=\"text/css\"></head><center>或是主题的字数超过了六个字,请改短一点唷<br><a href=javascript:history.back()>回上一页</a> <A href='index.php?k=$k'>回讨论区</A></center>",$k);
header("Location:index.php?k=$k");
?>