[feladat @ 284]
Validation of an emailaddress now uses new hostname validation function as well. Issue reported by Alessandro Bono. Closes: #60.
--- 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;