Common summary of php user registration. Common summary of php user registration, including some common summaries that are used to detect whether the user name format meets the user name format and whether the value of the user name format detection parameter is the same and whether the detection parameters are common for Chinese php user registration, this includes checking whether the user name format meets the user name format, checking whether the values of the user name format are the same, checking whether the parameters are Chinese, and so on.
| The code is as follows: |
|
/** * Check */ Class Check { /** * IsUsername function: checks whether the username format is correct. * $ Argv is the username parameter to be checked * $ RegExp is the regular statement to be checked * Return value: return the username in the username format, not false. */ Function IsUsername ($ Argv ){ $ RegExp =/^ [a-zA-Z0-9 _] {3, 16} $/; // It consists of uppercase and lowercase letters and numbers and can be 3-16 characters in length. Return preg_match ($ RegExp, $ Argv )? $ Argv: false; } /** * IsMail function: checks whether the email format is correct. * Return value: the email is returned in the correct email format, not 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: checks whether the parameter values are the same. * Return value: true is returned for the same value. false is returned for different values. */ Function IsSame ($ ArgvOne, $ ArgvTwo, $ Force = false ){ Return $ Force? $ ArgvOne ===$ ArgvTwo: $ ArgvOne ==$ ArgvTwo; } /** * IsQQ function: checks whether the parameter value complies with the QQ number format. * Return value: the correct QQ number. the returned QQ number is not false. */ Function IsQQ ($ Argv ){ $ RegExp =/^ [1-9] [0-9] {5, 11} $ /; Return preg_match ($ RegExp, $ Argv )? $ Argv: false; } /** * IsMobile function: checks whether the parameter value is in the correct Chinese mobile phone number format. * Return value: indicates the correct mobile phone number. if not, false is returned. */ Function IsMobile ($ Argv ){ $ RegExp =/^ (? : 13 | 15 | 18) [0-9] {9} $ /; Return preg_match ($ RegExp, $ Argv )? $ Argv: false; } /** * IsTel function: checks whether the value of the parameter is a positive Chinese phone number. the format includes a region code. * Return value: the correct phone number. the returned phone number is not false. */ Function IsTel ($ Argv ){ $ RegExp =/[0-9] {3, 4}-[0-9] {7, 8} $ /; Return preg_match ($ RegExp, $ Argv )? $ Argv: false; } /** * IsNickname function: checks whether the parameter value is in the correct nickname format (Beta) * Return value: the returned nickname format is correct, not false. */ Function IsNickname ($ Argv ){ $ RegExp = '/^ s * $ | ^ c: \ con $ | [%, * "st <> &' ()] | xA1xA1 | xACxA3 | ^ Guest | ^ xD3xCExBFxCD | xB9x43xABxC8/is '; // Copy From DZ Return preg_match ($ RegExp, $ Argv )? $ Argv: false; } /** * IsChinese function: checks whether the parameter is Chinese. * Return value: 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; } } ?> |
...