-
-
/** - * Check mobile email username detection class
- */
- Class Check{
/**
- * IsUsername function: Check whether it matches the user name format
- * $Argv is the user name parameter to be checked
- * $RegExp is the regular statement to be checked
- * Return value: Returns the user name if it matches the user name format, not false
- */
- Function IsUsername($ Argv){
- $RegExp='/^[a-zA-Z0-9_]{3,16}$/'; //It consists of uppercase and lowercase letters and numbers and the length is 3-16 characters directly
- return preg_match($ RegExp,$Argv)?$Argv:false;
- }
/**
- * IsMail function: Check whether the email format is correct
- * Return value: Return the email if it is the correct email format, 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: Check whether the values of the parameters are the same
- * Return value: return true if they are the same, false if they are not the same
- */
- Function IsSame($ArgvOne,$ArgvTwo,$Force=false){
- return $Force?$ArgvOne===$ArgvTwo:$ArgvOne==$ArgvTwo;
- }
-
/**
- * IsQQ function: Check whether the parameter value conforms to the format of the QQ number
- * Return value: Return the QQ number if it is the correct 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 parameter value is in the correct Chinese mobile phone number format
- * Return value: Return the mobile phone number if it is the correct mobile 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 positive. The format of the Chinese phone number includes the area code.
- * Return value: If it is the correct phone number, return the phone number. If not, return false.
- */
- Function IsTel($Argv){
- $RegExp='/[0-9]{3,4}-[0-9]{7,8}$/';
- return preg_match($RegExp, $Argv)?$Argv:false;
- }
/**
- * IsNickname function: Check whether the parameter value is the correct nickname format (Beta)
- * Return value: Return the nickname format if it is the correct nickname format, otherwise 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: It is the return parameter, not 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;
- }
- }
- ?>
-
Copy code
|