Created
February 8, 2013 06:17
-
-
Save fomigo/4737017 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // https://github.com/morfah/MorfMedia/blob/master/validate.php | |
| function valid($str, $minln, $validlength) { | |
| $validmask="abcdefghijklmnopqrstuvwxyz0123456789_- "; | |
| $str=strtolower($str); | |
| if (strspn($str, $validmask) == strlen($str) && $validlength >= strlen($str) && $minln <= strlen($str)) | |
| return true; | |
| else | |
| return false; | |
| } | |
| function emailvalid($str, $validlength) { | |
| $validmask="abcdefghijklmnopqrstuvwxyz0123456789_-@."; | |
| $str=strtolower($str); | |
| if (strspn($str, $validmask) == strlen($str) && $validlength >= strlen($str) && strpos($str, '@',1) && strpos($str, '.',1)) | |
| return true; | |
| else | |
| return false; | |
| } | |
| function numbervalid($str, $validlength) { | |
| $validmask="0123456789"; | |
| if (strspn($str, $validmask) == strlen($str) && strlen($str) <= $validlength && strlen($str) > 0) | |
| return true; | |
| else | |
| return false; | |
| } | |
| function space2html($str) { | |
| $str = str_replace(' ','+', $str); | |
| return $str; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment