Forum Moderators: coopster

Message Too Old, No Replies

Email verification entered thr' Post

email,form,post,

         

NeilsPHP

10:35 pm on Jul 10, 2008 (gmt 0)

10+ Year Member



I am trying to verify email entered thr'POST but even though i m entereing wrong domain names like yahee.com or hotmall.com,they are still getting validated.
What is it that I am doing wrong in this code ?

$Email = htmlspecialchars(stripslashes(strip_tags($Email)));
if ( eregi ( '[a-z¦¦0-9]@[a-z¦¦0-9].[a-z]', $Email ) )
{
$domain = explode( "@", $Email );
if ( @fsockopen ($domain[1],80,$errno,$errstr,3))

{echo("$Email is Valid");}
else
{echo("wrong email entered");}
}

MattAU

3:26 am on Jul 11, 2008 (gmt 0)

10+ Year Member



if ( @fsockopen ($domain[1],80,$errno,$errstr,3))

is the problem.

Checking whether the domain is online isn't really useful, because many typo domains are hosted (those examples you gave both are) and there are plenty of people using domains that aren't hosted just for mail.

On a seperate note, the regex pattern you're using doesn't allow for country specifc domains .co.uk, .com.au etc. I'd suggest having a search for a good email validation pattern.