FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


how does this email validation works?





imagefree
I have problem with just the condition inside if

Code:
if(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><font face='Verdana' size='2' color=red>Invalid email</font></center>";
}else{echo "<center><font face='Verdana' size='2' color=green>Valid Email</font></center>";}
}


please explain this.
kv
It uses regular expressions. Here is a nice tutorial on regular expressions.

http://weblogtoolscollection.com/regex/regex.php

Also check

http://www.php.net/eregi
MrBlueSky
"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$" means, in english:

1. beginning of a line, followed by
2. one or more of these: [_a-z0-9-],
3. followed by a dot, followed by one or more of [_a-z0-9-]
where 3 may appear 0, 1 or more times
4. followed by @
5. followed by one or more of [a-z0-9-]
6. followed by a dot, followed by one or more of [a-z0-9-]
where 6 may appear 0, 1 or more times
7. followed by a dot
8. followed by 2 or 3 letters
9. followed by end of line.

where, for example, [a-z0-9-] stands for any letter, number or a dash (-)

I doubt if this makes it any clearer Wink , but to really understand it you'll have to read the links kv gave.
mahirharoon
it checks wheather a space is there is illegal characters and ckesks there is a @ or not
Related topics
How to email data...
Fantastic form creator program
Need super simple method to send a form to an email address
Does banner exchange works with the PR?
Email validation
phpc0d3r
Time magazine ordered to pay $106 million damages
How does this system works?
Wordpress subdomains not working
Waiting for the email validation...
Email Validation
Help with php email
SMTP Not sending mail out
how does RSS really works?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.