PHP Simple Message Board Code
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>php Simple message Board code </title>
<body>
<table width= "98%" border= "0" >
<form id= "Form1" Name= "Form1" method= "Post" action= "comment/comment.php?nid=21" >
<tr>
<TD colspan= "2" > </td>
</tr>
<tr>
<TD colspan= "2" >
<label></label>
<label>
<textarea name= "Content" cols= "rows=" "8" id= "Content" ></textarea>
</label>
</td>
</tr>
<tr>
<TD width= "5%" ><label>
<input name= "Code" type= "text" id= "code" size= "8"/>
</label></td>
<TD width= "The ><label> </label>
Input Verification Code </td>
</tr>
<tr>
<TD colspan= "2" ><input type= "Submission" name= "submit" value= "submitted comments"/></td>
</tr>
</form>
</table>
$content = postget (' content ', 1);
$tel = Postget (' tel ', 1);
$cname = Postget (' Mail ', 1);
$ip = Getrealip ();
If (Mb_strlen ($content) > | | mb_strlen ($content) <5)
{
message (' message length 5-100 characters ');
}
Else if (strlen ($tel) <5 && strlen ($tel) >15)
{
message (' Contact phone error! ')
}
Else if (!preg_match (/^) ([a-z0-9_.-]+) @ ([da-z.-]+). ( [A-Z.] {2,6}) $/", $cname))
{
message (' Enter the correct email address! ');
}
Else
{
$date = Date ("y-m-d h:i:s");
$Db = new Db ();
$sql = Insert Into Cn_loupan_news_comment (NID,CONTENT,DATETIME,CNAME,IP) VALUES (' 0 ', ' $content ', ' $date ', ' $cname ', ' $tel ');
try{
$Db->query ($sql);
message (' Thank you for your advice, we'll deal with it as soon as possible ...! ', '/complaints.php ');
}catch (execption $e) {
message (' Send message failed! ');
}
}
Function Postget ($str, $post =0)
{
empty ($str)? Die (' Para is null '. $str. '! '): ';
if ($post)
{
return addslashes (Htmlspecialchars (isset STR])? $_post[$str]: ");
}
else
{
return addslashes htmlspecialchars (isset ($_GET[$str] ) $_get[$str]:
</body>