View Full Version : PHP E-Mail validation
Dynasty
09-08-2002, 01:55 AM
The following bit of code checks if an email in in a standard for as in like name@domain.whatever
$email = <email to check>;
$mail = ".+@.+\..+";
if(eregi($mail,$email))
{
<success code here>
}
else
{
<fail code here>
}
Replacing the bits in the <> with appropriate things of course. Just thought that may be helpful.
-TheDarkEye-
09-08-2002, 02:38 AM
here is how i would do the same thing in coldfusion:
function IsEmail(Email)
{
if (REFindNoCase("^['_a-z0-9-]+(\.['_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name))$", Email))
{
return TRUE;
}
else
{
return FALSE;
}
}
it uses a regular expression, which is very strict about what it will verify as real email address. you might want to consider converting it to php...
Originally posted by Dynasty
The following bit of code checks if an email in in a standard for as in like name@domain.whatever
$email = <email to check>;
$mail = ".+@.+\..+";
if(eregi($mail,$email))
{
<success code here>
}
else
{
<fail code here>
}
Replacing the bits in the <> with appropriate things of course. Just thought that may be helpful.
could u explain what eregi() function does.thanks:)
-TheDarkEye-
09-08-2002, 03:02 AM
you need to visit php.net. ;)
http://www.php.net/manual/en/function.eregi.php
it is a regualar expression function and it is case-insensitive.
Thanks now I understand:cool:
Dynasty
09-08-2002, 04:12 AM
Regular expressions are evil little things :monkey: :weee:
-TheDarkEye-
09-08-2002, 02:55 PM
well, maby you need to read more about them?
Dynasty
09-08-2002, 06:16 PM
Hehe.
-TheDarkEye-
09-09-2002, 12:07 AM
i think its fairly straight forward if you know what all the special characters mean.
what DO they mean?? :eek:
-TheDarkEye-
09-19-2002, 11:28 PM
it would be a major buzz killer if i had to answer you right now. so ill just give you a link:
http://livedocs.macromedia.com/cfmxdocs/Developing_ColdFusion_MX_Applications_with_CFML/regexp3.jsp#1117230
i think that should cover just about all of it.
pauladams
12-07-2010, 12:17 AM
This is a code:-
f(isset($todo) and $todo=="test"){
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){
echo "<center>Invalid email</center>";
}else{
echo "<center>Valid Email</center>";}
}
heianzi
12-12-2010, 11:09 PM
tile CloneDVD
cloneDVD介绍: CloneDVD is a flexible and easy to use <a href="http://www.clonedvd.net/">clonedvd</a> software.Without special setting, CloneDVD automatically removes all protections (CSS, RC, RCE, UOPs and Sony ARccOS) during the process of copying, lets you freely copy all of your DVD movie collections,
whywhy
04-18-2011, 01:44 AM
Code must write more detailed will be OK~~
ExpertsGuide
11-19-2011, 11:06 PM
@ "pauladams", what if the TLD is more than 3 characters long, like , .asia .aero .travel etc.
Your code wont work, right?
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.