/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /************************************************************************* *** Example of Usage: **************************************************** ***** Validate::string('717 123 4567',Validate::SPACE.Validate::PHONE); ** ***** returns true ******************************************************* *************************************************************************/ class Validate { const name = 'Simple Validation Class'; const version = '0.2a'; const NUM = '0-9'; const SPACE = '\s'; const ALPHA_LOWER = 'a-z'; const ALPHA_UPPER = 'A-Z'; const ALPHA = 'a-zA-Z'; const EALPHA_LOWER = 'a-zÃ�¡Ã�©Ã�ÂÂ�³�º�½� �¨�¬�²�¹�¤�«�¯�¶�¼�¿�¢�ª�®�´�»�£�±�µ�¡�¥�¦�§���°�¸�¾��'; const EALPHA_UPPER = 'A-Z���������������������������������¸����������������� ��������������'; const EALPHA = 'a-zÃ�¡Ã�©Ã�ÂÂ�³�º�½� �¨�¬�²�¹�¤�«�¯�¶�¼�¿�¢�ª�®�´�»�£�±�µ�¡�¥�¦�§���°�¸�¾��A-Z���������������������������������¸����������������� ��������������'; const PUNCTUATION = '\s\.\-_,;\/\:&"\'\?\!\(\)'; const ALL = '0-9\s\.\-_,;\/\:&"\'\?\!\(\)a-zÃ�¡Ã�©Ã�ÂÂ�³�º�½� �¨�¬�²�¹�¤�«�¯�¶�¼�¿�¢�ª�®�´�»�£�±�µ�¡�¥�¦�§���°�¸�¾��A-Z���������������������������������¸����������������� ��������������'; const PHONE = '0-9\s+\-.\(\)#\*\/'; static private function version_check() { }//end function public function url ($url, $length = 12, $http=TRUE) { if (self::version_check()) { $flag = null; if ($http) $flag = FILTER_FLAG_PATH_REQUIRED; }//end if }//end function public function string ($string, $charset=self::ALL, $length=1) { }//end function public function integer ($integer, $min=null, $max=null) { if (self::version_check()) { }//end if }//end function public function email ($email) { && self::url($broken[1],5,FALSE) && self::string($broken[0],self::ALPHA.self::NUM.'\.\-_'); }//end function } ?>
Comments
