php mysql留言板代码
本款代码是一款简单的php留言板代码 ,就是把用户提交的数据保存到mysql数据库,判断进行验证用户是否为非法用户,非常简单的比较适合初学者。
<form name="form1" method="post" action=""> <label> <input type="text" name="tp_nam"> </label> <label> <input type="submit" name="Submit" value="提交"> </label> </form> <?php //php mysql留言板代码 $tp_time = $other->shortTime(); if ($_POST['tp_nam'] != "") { //-------添加开始------------- $tp_name = $_POST['tp_nam']; $tp_contents = $_POST['message']; $at_id = $_POST['at_id']; if (!isset($_POST['chkkd'])) { exit(); } if ($_POST['chkkd'] == $_SESSION['CodeNum']) { $_SESSION['CodeNum'] = ''; $res = $tpEdit->tpInsert($tp_name, $tp_contents, $tp_time, $at_id, $col_id, 0, 0); } else { echo "<script> alert('验证码输入错误 ');window.location.href='www.phprm.com';</script>"; } //-----------添加结束----------- if ($res == 1) { echo "<script>alert('操作成功!');window.close();</script>"; exit(); } else { echo "<script>alert('请勿重复发帖,五分钟后再来!');window.close();</script>"; } }
教程网址:http://www.phprm.com/code/33207.html
欢迎收藏∩_∩但请保留本文链接。