> Peter Lind wrote:
> [snip]
>> if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
>>     echo "Bad user! Bad user!";
>> }
>> 
>> Regards
>> Peter
> 
> 
> thanks peter... wish I would have known about filter_var before
> writing the other checkers. ;-)


Hi D   :-)

I was following along.. also felt pleased to be introduced to filter_var ... 
and then happened to see this:

http://us3.php.net/manual/en/function.filter-var.php
the user-contributed note, headed with:
php dot 5 dot leenoble at SPAMMENOTspamgourmet dot net 18-Dec-2009 10:01

"Note that FILTER_VALIDATE_EMAIL used in isolation is not enough for most (if 
not all) web based registration forms.

It will happily pronounce "yourname" as valid because presumably the 
"@localhost" is implied, so you still have to check that the domain portion of 
the address exists.
"

So I am surprised Peter recommended it.  (?)

AFAICT, I should stick with what I was using:

$emailPattern = '/^[\w\.\-_\+]+@[\w-]+(\.\w{2,4})+$/i'; //
$emailReplacement = 'theEmailAppearsValid';
$emailChecker = preg_replace($emailPattern, $emailReplacement, $emailToCheck);
if($emailChecker == 'theEmailAppearsValid') {
        //--theEmailLooksValid, so use it...
} else {
        //--theEmailLooksBad, so do not use it...
}


------------
Govinda


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to