本款代码是一款简单的php留言板代码 ,就是把用户提交的数据保存到mysql数据库,判断进行验证用户是否为非法用户,非常简单的比较适合初学者。
//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 ;
}
//-----------添加结束-----------
if ($res == 1) {
echo ;
exit();
} else {
echo ;
}
}
?>