473,322 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Email Validation (Block Unwanted Addresses)

@$email = addslashes($_POST['email']);

if (! ereg('^[*a-z\'0-9]+([._-][*a-z\'0-9]+)*@([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 = /.*@(hsbc|barclays|hotmail)\.com$/.test(Addr)

---
Many Thanks to any replys in advanced!

Regards,
Jason
Jan 24 '08 #1
3 2062
On Thu, 24 Jan 2008 12:20:50 +0100, ibizara <ib*****@googlemail.comwrote:
@$email = addslashes($_POST['email']);

if (! ereg('^[*a-z\'0-9]+([._-][*a-z\'0-9]+)*@([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 = /.*@(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 once
every 1 or 2 months)

if(preg_match('/@(hsbc|barclays|hotmail)\.com$/i',$email)){
//the code
}
--
Rik Wasmus
Jan 24 '08 #2
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 once *
every 1 or 2 months)

if(preg_match('/@(hsbc|barclays|hotmail)\.com$/i',$email)){
//the code}
// Receiving variables
@$email = addslashes($_POST['email']);

if (! ereg('^[*a-z\'0-9]+([._-][*a-z\'0-9]+)*@([a-z0-9]+([._-][a-
z0-9]+))+$', $email)){
include_once("error.inc");
die();
}

if(preg_match('/@(hotmail|rbs|barclays|lloydstsb|hsbc|natwest)\.(c om|co
\.uk)$/i',$email)){
include_once("not_allowed.inc");
die();
}

======================
Thanks for the help :)
======================

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 *@hotmail.com to come through I do wish for
us**@hotmail.com to come through.

Any guidance on using the " * " not as a wildcard... ??
if(preg_match('[*]/@(hotmail... ??

Thanks,
J
Jan 24 '08 #3
Any guidance on using the " * " not as a wildcard... ??
if(preg_match('[*]/@(hotmail... ??
if(preg_match('/\*@(hotmail|rbs|barclays|lloydstsb|hsbc|natwest)\. (com|
co\.uk)$/i',$email)){

Found I only needed to add \*

So all sorted and working a treat :)
Jan 24 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Chris Sharman | last post by:
I'm doing a rough validation of an email address client-side (using js), but it's not enough - our customer service people are apparently incapable of typing in an email address without error - we...
2
by: Angel | last post by:
Hi there, I need help pls..I'm using c# on a webform and I have this regex validation for email addresses: ValidationExpression ="\w+(\w+)*@\w+(\w+)*\.\w+(\w+)* " I'm having isssues when submit...
6
by: xxnonexnonexx | last post by:
I am looking to do some email validation and many of the scripts I've located online are great basic email validators. They check to see that the email address is something along the lines of...
117
by: Steevo | last post by:
Any suggestions as to the best programs for cloaking email addresses? Many thanks -- Steevo
12
by: Dag Sunde | last post by:
My understanding of regular expressions is rudimentary, at best. I have this RegExp to to a very simple validation of an email-address, but it turns out that it refuses to accept mail-addresses...
4
by: ron | last post by:
I have a access based guest book. I want to create a validation rule to block certain words or parts of a srting. How do i do this? ie: this is a nice site. come visit my porn site at www.abc.zy...
23
by: codefire | last post by:
Hi, I am trying to get a regexp to validate email addresses but can't get it quite right. The problem is I can't quite find the regexp to deal with ignoring the case james..kirk@fred.com, which...
8
by: needhelp | last post by:
Hi there, I really need some help, everything I've tried, all I've found, doesn't seem to work. I have lost an email address which is very important to me. I really need to contact that person...
10
by: ll | last post by:
Hi, I currently am using the following regex in js for email validation, in which the email addresses can be separated by commas or semicolons. The problem, however, lies in that I can type two...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.