26 Eylül 2007 Çarşamba

Email address validator

Author: Tobias Ratschiller & izzy, http://www.zend.com/tips/tips.php?id=224&single=1

<?php

/*
Original script by Tobias Ratschiller.
* top level domain must have at least 2 chars
* there can be more than one dot in the address
*/

function is_email($address) {
$rc1 = (ereg('^[-!#$%&'*+./0-9=?A-Z^_`a-z{}~]+'.
'@'.
'[-!#$%&'*+\/0-9=?A-Z^_`a-z{}~]+.'.
'[-!#$%&'*+\./0-9=?A-Z^_`a-z{}~]+$',
$address));
$rc2 = (preg_match('/.+.ww+$/',$address));
return ($rc1 && $rc2);
}
?>


0 Comments: