Email Validation (Block Unwanted Addresses)
[at] $email = addslashes($_POST['email']);
if (! ereg('^[*a-z\'0-9]+([._-][*a-z\'0-9]+)* [at] ([a-z0-9]+([._-][a-
z0-9]+))+$', $email))
{
include_once("error.inc");
die();
}
---
I need to add a if contains the below then include_once("error.inc");
Spam = /.* [at] (hsbc|barclays|hotmail)\.com$/.test(Addr)
---
Many Thanks to any replys in advanced!
Regards,
Jason
Re: Email Validation (Block Unwanted Addresses)
On Thu, 24 Jan 2008 12:20:50 +0100, ibizara <ibizara [at] googlemail.com> wro=
te:
> [at] $email =3D addslashes($_POST['email']);
>
> if (! ereg('^[*a-z\'0-9]+([._-][*a-z\'0-9]+)* [at] ([a-z0-9]+([._-][a-
> z0-9]+))+$', $email))
You do realise this will make a lot of valid emailadresses invalid? =
Domains are not limited to the ascii set for instance, and [a-z0-9'._-] =
=
are not the only valid characters in an email name.
Also, it's recommended to use the preg_* functions instead of ereg*
> {
> include_once("error.inc");
> die();
> }
>
> ---
> I need to add a if contains the below then include_once("error.inc");
>
> Spam =3D /.* [at] (hsbc|barclays|hotmail)\.com$/.test(Addr)
Hmmm? I often use my spambucket hotmail address (see my mailaddress :) )=
of =
10 years ago for sites I'm not sure about. (Yes, I can still access it, =
=
but I normally won't unless I just registered with that mail / about onc=
e =
every 1 or 2 months)
if(preg_match('/ [at] (hsbc|barclays|hotmail)\.com$/i',$email)){
//the code
}
-- =
Rik Wasmus
Re: Email Validation (Block Unwanted Addresses)
> Hmmm? I often use my spambucket hotmail address (see my mailaddress :) )of=
=A0
> 10 years ago for sites I'm not sure about. (Yes, I can still access it, =
=A0
> but I normally won't unless I just registered with that mail / about once =
=A0
> every 1 or 2 months)
>
> if(preg_match('/ [at] (hsbc|barclays|hotmail)\.com$/i',$email)){
> //the code}
// Receiving variables
[at] $email =3D addslashes($_POST['email']);
if (! ereg('^[*a-z\'0-9]+([._-][*a-z\'0-9]+)* [at] ([a-z0-9]+([._-][a-
z0-9]+))+$', $email)){
include_once("error.inc");
die();
}
if(preg_match('/ [at] (hotmail|rbs|barclays|lloydstsb|hsbc|natwes t)\.(com|co
\.uk)$/i',$email)){
include_once("not_allowed.inc");
die();
}
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D
Thanks for the help :)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D
For info this is just for a whitelist that we have created for users
to add email addresses into.
Although I do not wish for * [at] hotmail.com to come through I do wish for
user [at] hotmail.com to come through.
Any guidance on using the " * " not as a wildcard... ??
if(preg_match('[*]/ [at] (hotmail... ??
Thanks,
J
Re: Email Validation (Block Unwanted Addresses)
> Any guidance on using the " * " not as a wildcard... ??
> if(preg_match('[*]/ [at] (hotmail... ??
if(preg_match('/\* [at] (hotmail|rbs|barclays|lloydstsb|hsbc|natw est)\.(com|
co\.uk)$/i',$email)){
Found I only needed to add \*
So all sorted and working a treat :)