Skip to content

Commit

Permalink
Validation of an emailaddress now uses new hostname validation functi…
Browse files Browse the repository at this point in the history
…on as well. Issue reported by Alessandro Bono. Closes: poweradmin#60.
  • Loading branch information
rejozenger committed May 31, 2008
1 parent 3205e95 commit d1f1af1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions inc/toolkit.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,9 @@ function parse_template_value($val, $domain, $webip, $mailip)
}


/*
* 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;
Expand Down

0 comments on commit d1f1af1

Please sign in to comment.