Home > CMS Tutorial > DEDECMS > body text

DedeCMS custom form mobile phone number and email verification

(*-*)浩
Release: 2019-11-29 15:06:06
Original
3663 people have browsed it

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 地址!";
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!