Common php user registration detection classes .? Php *** Check class * ClassCheck {*** 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
-
- /**
- * 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: concon $ | [%, * "s <> & \ ()] | 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;
- }
- }
- ?>
Http://www.bkjia.com/PHPjc/486137.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/486137.htmlTechArticle? Php/*** Check Class */Class Check {/*** IsUsername function: check whether the username format * $ Argv is the username parameter to be checked * $ RegExp is the regular statement to be checked...