$v) { my_stripslashes($a[$k]); } } else { $a = stripslashes($a); } } # # Don't use this. # function undo_magic_quotes(&$a) { if(get_magic_quotes_gpc()) { global $HTTP_POST_VARS, $HTTP_GET_VARS; foreach($HTTP_POST_VARS as $k => $v) { stripslashes_array($HTTP_POST_VARS[$k]); global $$k; stripslashes_array($$k); } foreach($HTTP_GET_VARS as $k => $v) { stripslashes_array($HTTP_GET_VARS[$k]); global $$k; stripslashes_array($$k); } } } # # Returns TRUE if argument contains only alphabetic characters. # function is_alpha($v) { return (eregi('[^A-Z]',$v) ? false : true) ; } # # Returns TRUE if argument contains only numeric characters. # function is_num($v) { return (eregi('[^0-9]',$v) ? false : true) ; } # # Returns TRUE if argument contains only alphanumeric characters. # function is_alnum($v) { return (eregi('[^A-Z0-9]',$v) ? false : true) ; } # # Returns TRUE if argument is in proper e-mail address format. # function is_email($v) { return (eregi('^[^@ ]+\@[^@ ]+\.[A-Z]{2,4}$',$v) ? true : false); } # # Returns True if the given string is a IP address # function is_ip( $ip = null ) { if( !$ip or strlen(trim($ip)) == 0){ return false; } $ip=trim($ip); if(preg_match("/^[0-9]{1,3}(.[0-9]{1,3}){3}$/",$ip)) { foreach(explode(".", $ip) as $block) if($block<0 || $block>255 ) return false; return true; } return false; } # # Returns True if the given string is a valid FQDN # function is_fqdn($FQDN) { // remove leading wildcard characters if exist $FQDN = preg_replace('/^\*\./','', $FQDN, 1); return (!empty($FQDN) && preg_match('/(?=^.{1,254}$)(^(?:(?!\d|-)[a-z0-9\-]{1,63}(? 0); } # # Checks regexp in every element of an array, returns TRUE as soon # as a match is found. # function eregi_array($regexp, $a) { foreach($a as $e) { if (eregi($regexp,$e)) return true; } return false; } # # Reads entire file into a string # Same as file_get_contents in php >= 4.3.0 # function my_file_get_contents($f) { return implode('', file($f)); } ?>