have the following code trying to validate an email address...
Code:
if ((strlen($email)>=5)&&(strlen($email)<50)){ //min length 5 and max length 50
if ((!eregi("^[ //the above denies emails starts with 'www' or denies emails with endings 'setroPETS.com'
//to prevent useless emails from being entered
if (!eregi("([A-Za-z0-9]){4,15}$", $email)){ //prevent emails with 'aaaaaa' or '888888'
if (eregi("^[a-zA-Z0-9\.\_]+@[a-zA-Z0-9]+\.[a-zA-Z0-9\.]{2,4}$", $email)){
The problem is in the line that is trying to check for emails starting with ' I am trying to prevent emails with the username and ones with the domain name 'setropets.com' to prevent useless email addresses from clodding the db?
Currently it does allow something like and bob@setropets.com
any ideas as to what i got wrong?
Bastien
There are many ways to skin this cat,
but it still tastes like chicken
Code:
if ((strlen($email)>=5)&&(strlen($email)<50)){ //min length 5 and max length 50
if ((!eregi("^[ //the above denies emails starts with 'www' or denies emails with endings 'setroPETS.com'
//to prevent useless emails from being entered
if (!eregi("([A-Za-z0-9]){4,15}$", $email)){ //prevent emails with 'aaaaaa' or '888888'
if (eregi("^[a-zA-Z0-9\.\_]+@[a-zA-Z0-9]+\.[a-zA-Z0-9\.]{2,4}$", $email)){
The problem is in the line that is trying to check for emails starting with ' I am trying to prevent emails with the username and ones with the domain name 'setropets.com' to prevent useless email addresses from clodding the db?
Currently it does allow something like and bob@setropets.com
any ideas as to what i got wrong?
Bastien
There are many ways to skin this cat,
but it still tastes like chicken