isWhat.inc.php


SUBMITTED BY: Guest

DATE: Dec. 6, 2013, 10:04 a.m.

FORMAT: PHP

SIZE: 1.4 kB

HITS: 925

  1. <?php
  2. function isWhat( $IWstring, $IW )
  3. {
  4. $WPM = NULL;
  5. if (strlen( $IWstring ) == NULL)
  6. {
  7. return 0;
  8. }
  9. else
  10. {
  11. if( $IWstring != NULL )
  12. {
  13. switch ( $IW )
  14. {
  15. case 'email': $WPM = '/^[_a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-.]+\.[a-zA-Z]{2,6}$/';
  16. break;
  17. case 'hp': $WPM = '/^[(http:\/\/)]+[a-zA-Z0-9-.]+$/';
  18. break;
  19. case 'decimal': $WPM = '/^[0-9]{1,}+\.[0-9]{2,}+$/';
  20. break;
  21. default: $WPM = NULL;
  22. break;
  23. }
  24. if( $WPM != NULL )
  25. {
  26. if ( !preg_match( $WPM, $IWstring ) )
  27. {
  28. return 0;
  29. }
  30. else return 1;
  31. }else return 0;
  32. }
  33. }
  34. }
  35. ?>

comments powered by Disqus