RE: [PHP] Verify Email
| From: | Greg Schnippel | Date: | Wed, 20 Dec 2000 16:58:26 +0000 |
| Subject: | RE: [PHP] Verify Email | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-31246@lists.php.net to get a copy of this message | ||
This problem always gives me grief but this code here seems to
be able to handle lots of different types of e-mail addresses,
including the ridiculous 'domain.domain.domain.domain.us'
addresses.
Would appreciate suggestions on rewrites..
#-------------------------------------------------------------------------
# FUNCTION check_mail()
# RECEIVES an e-mail address variable
# RETURNS 1/0 depending on whether e-mail address is valid
# EXPECTS nothing
# SETS nothing
# DOES does a regular expression test on a variable to determine if it
is a valid
# e-mail address
function check_email($email) {
$email = strtolower($email);
$test_email = ereg(".*@[A-Za-z0-9-]*\.[A-Za-z0-9-]*[A-Za-z0-9.-]*",
$email);
if ((ereg(",", $email)) || ereg("\ ", $email) || (ereg("^M",
$email)) || (ereg("\(", $email)) || (ereg("\)",$email)) ||(ere$
$test_email=0;
}
return $test_email;
}
-----Original Message-----
From: php-general-return-31166-gschnippel=forumone.com@lists.php.net
[mailto:php-general-return-31166-gschnippel=forumone.com@lists.php.net]O
n Behalf Of Website4S@aol.com
Sent: Wednesday, December 20, 2000 1:43 AM
To: php-general@lists.php.net
Subject: [PHP] Verify Email
Hi,
I have a little form which has an email address field, I don`t suppose
anyone
has an if statement which I can use to verify that a user has entered a
properly formatted email address?
TIA
Ade
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net