Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

eregi help please

Status
Not open for further replies.

Bastien

Programmer
May 29, 2000
1,683
CA
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(&quot;^[ //the above denies emails starts with 'www' or denies emails with endings 'setroPETS.com'
//to prevent useless emails from being entered
if (!eregi(&quot;([A-Za-z0-9]){4,15}$&quot;, $email)){ //prevent emails with 'aaaaaa' or '888888'

if (eregi(&quot;^[a-zA-Z0-9\.\_]+@[a-zA-Z0-9]+\.[a-zA-Z0-9\.]{2,4}$&quot;, $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
 
Why would you even want to use [tt]eregi[/tt] for all those operations? This would be a HUGE overhead, since most of these things can be accomplished with some simple comparisons...
//Daniel
 
its what i ended up doing...and just using eregi for the format of the email itself

thx Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top