PHP User name password phone number legal judgment code

Source: Internet
Author: User
Tags ereg

Function name: CheckUser ($C _user)

Role: To determine whether a legitimate user name

Parameters: $C _user (user name to be detected)

Return Value: Boolean value

Note: none

The code is as follows Copy Code

function CheckUser ($C _user)

{

if (! Checklengthbetween ($C _user, 4)) return false; Width test

if (!ereg ("^[_a-za-z0-9]*$", $C _user)) return false; Special character test

return true;

}


Function name: Checkpassword ($C _passwd)

Role: Determine if the password is a legitimate user

Parameters: $C _passwd (password to be detected)

Return Value: Boolean value

Note: none

/

The code is as follows Copy Code

function Checkpassword ($C _passwd)

{

if (! Checklengthbetween ($C _passwd, 4)) return false; Width detection

if (!ereg ("^[_a-za-z0-9]*$", $C _passwd)) return false; Special character detection

return true;

}

Function name: Checktelephone ($C _telephone)

Role: To determine whether a legal telephone number

Parameters: $C _telephone (phone number to be detected)

Return Value: Boolean value

Note: none

//-----------------------------------------------------------------------------------

  code is as follows copy code

function Checktelephone ($C _telephone)

{

If!ereg ("^[+]?[ 0-9]+ ([xx-][0-9]+) *$ ", $C _telephone)) return false;

return true;

}

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.