Home > Backend Development > PHP Tutorial > Common detection classes for php user registration_PHP tutorial

Common detection classes for php user registration_PHP tutorial

WBOY
Release: 2016-07-13 17:41:25
Original
832 people have browsed it

  1. /**
  2. * Check detection class
  3. */
  4. Class Check{
  5. /**
  6. * IsUsername function: Check whether it matches the username format
  7. * $Argv is the username parameter to be tested
  8. * $RegExp is the regular statement to be tested
  9. * Return value: Return the username if it conforms to the username format, not false
  10. */
  11.                                                                                                                                                                                                     ’ s ’ s ’ s ’ s ’ s ’ t              And the length is 3-16 characters directly /* *
  12. * IsMail function: Check whether it is the correct email format
  13. * Return value: Return the email in the correct email format, not return false
  14. */
  15. function IsMail($Argv){
  16. $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 ;
  17.                                                                                                                                                                                                                                      🎝>*/< U>
  18. Function issame ($ argvone, $ argvtwo, $ force = false) {
  19. Return $ FORCE? $ Argvone === $ argvone == $ argvtwo;
  20. }
  21.                                                                                                   gExp=/^[1-9 | >
  22.                                                                                                                                                                                                                                               ; {9}$ /; /**
  23. * IsSmae function: Check whether the parameter values ​​are the same
  24. * Return value: true if the same, false if not the same
  25. */
  26.                                                                                                                                                                                                                                   at     ’ s ;
  27.                                                                                                                                                                                                                                           
  28.         
  29.         /**
  30. * IsNickname function: Check whether the parameter value is the correct nickname format (Beta)
  31. * Return value: If it is the correct nickname format, return the nickname format, if not, return false
  32. */
  33.          function IsNickname($Argv){
  34.                  $RegExp=/^s*$|^c:concon$|[%,*"s <>&()]|xA1xA1|xACxA3|^Guest|^xD3xCExBFxCD|xB9x43xABxC8/is; //Copy From DZ
  35.                  return preg_match($RegExp,$Argv)?$Argv:false;
  36.          }
  37.         
  38.          /**
  39. * IsChinese function: Check whether the parameter is Chinese
  40. * Return value: It is the return parameter, not false
  41. */
  42.         function IsChinese($Argv,$Encoding=utf8){
  43.                  $RegExp = $Encoding==utf8?/^[x{4e00}-x{9fa5}] $/u:/^([x80-xFF][x80-xFF]) $/;
  44.                  Return preg_match($RegExp,$Argv)?$Argv:False;
  45.         }
  46. }
  47. ?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486137.htmlTechArticle?php /*** Check detection class*/ Class Check{ /** * IsUsername函数:检测是否符合用户名格式 * $Argv是要检测的用户名参数 * $RegExp是要进行检测的正则语句...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template