[feladat @ 284]
authorrejo
Sat, 31 May 2008 16:06:49 +0000
changeset 176 18905ae8cca3
parent 175 0345d21f21b0
child 177 f40a03a3e849
[feladat @ 284] Validation of an emailaddress now uses new hostname validation function as well. Issue reported by Alessandro Bono. Closes: #60.
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;