Dan,

I'll give you a little piece of advise that was given to me a little while
back on this list:

Go to http://www.killersoft.com/ and grab a copy of the validateEmailFormat
program.

<QUOTE>
PHP4 translation of Jeffrey E.F. Friedl's definitive Email Regex Program
from O'Reilly's Mastering Regular Expressions.  This function is used to
confirm if an e-mail address adheres to the RFC 822 specification for
internet email addresses.
</QUOTE>

Rather than trying re-invent the wheel, why not use something that conforms
closely to specs, and is widely accepted by many development groups.


All you'll have to do is something like (function names and filenames may
not be right):

<?
include('inc/validEmailFormat.inc');
if(!validEmailFormat($emp_email))
    {
    echo "<center>please enter a valid email address</center>";
    }
?>


Side topic:  of course, you aren't checking for a valid email address at
all, your checking to see if the email address LOOKS valid.  You're not
checking to see if the address is attached to an email box, or furthermore
if there's anyone at the other end to open/read your email... you're just
validating the appearance of the address to fall within RFC 822 specs.

Subsequently [EMAIL PROTECTED] and [EMAIL PROTECTED]
will both return valid.


The only way to ensure an email address is truely valid is to send an email
to it, and have them respond... indicating that the address is linked to an
email box and furthermore, someone opened the email, read it, and responded.

Even then, this could be done by a robot I guess.


Justin French
--------------------
Creative Director
http://Indent.com.au
--------------------




on 05/07/02 12:23 AM, dan radom ([EMAIL PROTECTED]) wrote:

> I've got a form that's posted to a php page where I'm attempting to validate a
> field contains a valid email address.  The eregi below seems to be totally
> ignored...
> 
> if (eregi("^[a-z0-9\._-]+@[a-z0-9\._-]+$", $emp_email)) {
> echo "<center>please enter a valid email address</center>";
> exit;
> }
> 
> 
> $emp_email is being posted to the form.  Any ideas why this is being ignored?
> 
> dan


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

Reply via email to