[Phpwm] Simple PHP Contact Form

Lester Caine lester at lsces.co.uk
Wed Oct 14 07:35:06 UTC 2009


David Goodwin wrote:
>> if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$",
>> $emaila)) error_alert("Invalid Email Address");
> 
> My understanding is that there are a million and one regexps to  
> validate email addresses and it'd not the right one unless it is very,  
> very long.
> 
> Yours will fail on eg adresses which look like foo.o'reilly at ....  
> (valid) or foo+bar at ... (valid).
> 
> And it allows an _ in a domain name which isn't possible. I think  
> there are also tlds longer than 4 characters.
> 
> And ereg is deprecated, as has already been pointed out. Use preg_match
> 
> You'd have made the regexp easier to write in ' rather than " -  
> avoiding \\ escaping blah blah too i think.
> 
> Sorry if I sound bitchy,

That sounds quite constructive ;)
But fixing the faults would be helpful :)
I've got a lot of ereg legacy stuff I've got to work out how to re-write 
myself and any hints on conversion would be most welcome!

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php



More information about the Phpwm mailing list