Php simple message board code-PHP source code

Source: Internet
Author: User
Ec (2); php simple message board code & lt ;! DOCTYPEhtmlPUBLIC & quot;-W3CDTDXHTML1.0TransitionalEN & quot; www. w3.orgTRxhtml1DTDxhtml1-transitional. dtd & quot; & gt; & lt; htmlxmlns & quot; ww script ec (2); script

Php simple message board code




Php simple message board code





$ Content = PostGet ('content', 1 );
$ Tel = PostGet ('tel', 1 );
$ Cname = PostGet ('mail', 1 );
// $ Ip = getRealIp ();

If (mb_strlen ($ content)> 100 | mb_strlen ($ content) <5)
{
MessAge ('message Content Length: 5-characters ');
}
Else if (strlen ($ tel) <5 & strlen ($ tel)> 15)
{
MessAge ('Contact number 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 suggestion. We will handle it as soon as possible ...! ','/Complaints. php ');
} Catch (Execption $ e ){
MessAge ('sending MessAge failed! ');
}
}

Function PostGet ($ str, $ post = 0)
{
Empty ($ str )? Die ('para is null'. $ str .'! '):'';
If ($ post)
{
Return addslashes (htmlspecialchars (isset ($ _ POST [$ str])? $ _ POST [$ str]: '');
}
Else
{
Return addslashes (htmlspecialchars (isset ($ _ GET [$ str])? $ _ GET [$ str]: '');
}
}
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.