Home  >  Article  >  CMS Tutorial  >  DedeCMS custom form mobile phone number and email verification

DedeCMS custom form mobile phone number and email verification

(*-*)浩
(*-*)浩Original
2019-11-29 15:06:063671browse

DedeCMS custom form mobile phone number and email verification

#dedecms’ custom form does not filter the submitted information, and spam messages are often harassed. (Recommended Learning: Dream CMS )

## This site provides 2 testing rules. It uses regular methods to detect mobile phone numbers and mailboxes, modify Plus Just insert the following code into diy.php before submitting it to the database.

$telphone and $email are the submitted mobile phone number and email address. If they are not set by me, you can modify them yourself.

//判断手机号码是否正确
if(!eregi("^13[0-9]{9}|15[0-9]{9}$",$telphone))
{
showMsg('手机号码不对,请正确填写', '-1');
exit();
}
 
//验证邮箱
if (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$email)) {
echo "请您填写正确的E-Mail 地址!";
}

The above is the detailed content of DedeCMS custom form mobile phone number and email verification. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn