PHP user registration is commonly used in a number of common summary, including detecting whether the user name format detection conforms to the user name format detection parameters whether the same detection parameters are Chinese and so on.
The code is as follows |
Copy Code |
/** * Check Detection class */ Class check{ /** * Isusername function: Check if user name format is met * $ARGV is the user name parameter to be detected * $REGEXP is the regular statement to be detected * Return value: Returns user name in accordance with user name format, not return False */ function Isusername ($ARGV) { $REGEXP =/^[a-za-z0-9_]{3,16}$/; consists of uppercase and lowercase letters with numbers and a length of 3-16 characters directly Return Preg_match ($REGEXP, $Argv)? $ARGV: false; } /** * Ismail function: Detect if the message format is correct * Return value: Is the correct message format to return the message, not return false */ function IsMail ($ARGV) { $REGEXP =/^[a-z0-9][a-z.0-9-_] @[a-z0-9_-] (?:. [ a-z]{0,3}. [A-z] {0,2}|. [A-z] {0,3}|. [A-z] {0,2}) $/i; Return Preg_match ($REGEXP, $Argv)? $ARGV: false; } /** * Issmae function: The value of the detection parameter is the same * Return value: Same return true, not same return false */ function Issame ($ArgvOne, $ArgvTwo, $Force =false) { Return $Force? $ArgvOne = = = $ArgvTwo: $ArgvOne = = $ArgvTwo; } /** * ISQQ function: Check whether the value of the parameter is in line with the QQ number format * Return value: Is the correct QQ number to return QQ number, not return false */ function isqq ($ARGV) { $REGEXP =/^[1-9][0-9]{5,11}$/; Return Preg_match ($REGEXP, $Argv)? $ARGV: false; } /** * IsMobile function: Check whether the value of the parameter is the correct Chinese mobile phone number format * Return value: Is the correct mobile number to return the phone number, not return false */ function IsMobile ($ARGV) { $RegExp =/^ (?: 13|15|18) [0-9]{9}$/; Return Preg_match ($REGEXP, $Argv)? $ARGV: false; } /** * Istel function: Check whether the value of the parameter is a positive fetch in China phone number format including area code * Return value: Is the correct phone number to return the phone number, not return false */ function Istel ($ARGV) { $REGEXP =/[0-9]{3,4}-[0-9]{7,8}$/; Return Preg_match ($REGEXP, $Argv)? $ARGV: false; } /** * Isnickname function: Detects whether the value of the parameter is the correct nickname format (Beta) * Return value: is the correct nickname format to return the nickname format, not return False */ function Isnickname ($ARGV) { $REGEXP = '/^s*$|^c:\con\con$| [%,* ' st<>& ' ()]|xa1xa1|xacxa3|^guest|^xd3xcexbfxcd|xb9x43xabxc8/is '; Copy from DZ Return Preg_match ($REGEXP, $Argv)? $ARGV: false; } /** * Ischinese function: Check whether the parameter is Chinese * Return value: Is the return parameter, not return False */ function Ischinese ($ARGV, $Encoding =utf8) { $REGEXP = $Encoding ==utf8?/^[x{4e00}-x{9fa5}] $/u:/^ ([x80-xff][x80-xff]) $/; Return Preg_match ($REGEXP, $Argv)? $ARGV: False; } } ?> |
http://www.bkjia.com/PHPjc/631591.html www.bkjia.com true http://www.bkjia.com/PHPjc/631591.html techarticle PHP User Registration is commonly used in a number of common summary, including the detection of whether the user name format detection conforms to the user name format detection parameters whether the same detection parameters are Chinese ...