/ Published in: PHP
URL: http://mark.haktstudios.com/
This is a version of the previous script that is compliant with IPv6, it requires PHP 5 or newer, so yeah, if you don’t have it, it will fail horribly ( due to the AAAA record check ).
Expand |
Embed | Plain Text
/****************************************************************************** Is email valid?? This function verifies that the email address complies with the following standards: RFC 822 RFC 1035 RFC 2821 RFC 2822 It also ensures that the domain actually resolves. /******************************************************************************/ function e_valid($email) { // get position of the final @ symbol // split up the email address into domain and local parts // determine string length // verify strings aren't too short or too long if ($l_len < 1 || $l_len > 64) return false; if ($d_len < 1 || $d_len > 255) return false; // verify that we don't start or end with a . if ($local[0] == '.' || $local[$l_len-1] == '.') return false; if ($domain[0] == '.' || $domain[$d_len-1] == '.') return false; // verify we don't have two .'s in succession // check for disallowed characters { // check for invalid escape sequences in the local part return false; // check for valid DNS records return false; } // return true, the email is valid. return true; }
You need to login to post a comment.
