# HG changeset patch # User rejo # Date 1212250009 0 # Node ID 18905ae8cca32efc6b0ed6fc4fcff2c56e75ab96 # Parent 0345d21f21b003285dc9b40ccdf61abf2dfeeb0b [feladat @ 284] Validation of an emailaddress now uses new hostname validation function as well. Issue reported by Alessandro Bono. Closes: #60. diff -r 0345d21f21b0 -r 18905ae8cca3 inc/toolkit.inc.php --- a/inc/toolkit.inc.php Thu May 29 20:27:46 2008 +0000 +++ b/inc/toolkit.inc.php Sat May 31 16:06:49 2008 +0000 @@ -351,14 +351,9 @@ } -/* - * Validates an email address. - * Checks if there is something before the at '@' sign and its followed by a domain and a tld of minimum 2 - * and maximum of 4 characters. - */ -function is_valid_email($email) -{ - if(!eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.([a-z]{2,6}$)", $email)) { +function is_valid_email($address) { + $fields = split("@", $address, 2); + if((!eregi("^[0-9a-z]([-_.]?[0-9a-z])*$", $fields[0])) || !is_valid_hostname_fqdn($fields[1], 0)) { return false; } return true;