Re: [PHP] eregi(mail)

2002-05-21 Thread Denis L. Menezes

Hello friends,

I use the following code, but it does not work. Is there something wrong?

If
(ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%\'*+\\/0-9=?A-Z^_`a
-z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
$email_address))
){
  Print (Sorry, the email address seems to be invalid.);
  exit;
  }

Please help.
Denis
- Original Message -
From: Steve Buehler [EMAIL PROTECTED]
To: Kevin Stone [EMAIL PROTECTED]
Cc: PHP [EMAIL PROTECTED]
Sent: Saturday, May 11, 2002 2:45 AM
Subject: Re: [PHP] eregi(mail)


 Either Google is wrong (probably) or they are now allowing things like
 spaces into an email address.  There are actually several things that are
 not allowed in a standard email address.  Here is the code that I use.

ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%\'*+\\/0-9=?A-Z^_`a-
z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
 $subarray))
 I am honestly not sure where I got this code, but it has always worked for
 me and I have not found any YET that are good address that this kills.  I
 have also not found any bad ones YET that this lets through (unless the
 domain or user doesn't exist, of course).

 Steve

 At 01:26 PM 5/10/2002, you wrote:
 I had always been suspicious about email validators so I did a big long
 search on Google about standard address formats.  It turns out that aside
 from the @ symbol emails have no standard format whatsoever.  So
ereg('@',
 $email) is really the only functional email validator.
 
 You also have to think about what kind of email validation you need.  Do
you
 really need to control the format of the emails being stored in your
 database?  Or do you need to control the validity of the emails being
stored
 in your database?  There is a big difference.  A valid email address
isn't
 necessarily one that is formated in the way you expect.  It is one that
is
 active and can be mailed to.  There are a number of techniques you can
use
 to determine that.
 
 Well.. anyway sorry for going off on a tangent there.  In your search for
an
 email validator you got a bit more information than you expected.  I hope
it
 was useful in some tiny miniscule sort of way.  :)
 
 --
 Kevin Stone
 [EMAIL PROTECTED]
 
 
 - Original Message -
 From: Analysis  Solutions [EMAIL PROTECTED]
 To: PHP List [EMAIL PROTECTED]
 Sent: Friday, May 10, 2002 10:59 AM
 Subject: Re: [PHP] eregi(mail)
 
 
   Hi Liam:
  
   On Fri, May 10, 2002 at 09:48:58AM -0700, Liam Gibbs wrote:
Does anyone have a decent eregi statement for
validating e-mail addresses?
  
   eregi('^[a-z0-9_.=+-]+@([a-z0-9-]+\.)+([a-z]{2,6})$', $Email);
  
   Enjoy,
  
   --Dan
  
   --
  PHP classes that make web design easier
   SQL Solution  |   Layout Solution   |  Form Solution
   sqlsolution.info  | layoutsolution.info |  formsolution.info
T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-21 Thread Miguel Cruz

On Tue, 21 May 2002, Denis L. Menezes wrote:
 I use the following code, but it does not work. Is there something wrong?
 
 If
 (ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.''.'[-!#$%\'*+\\/0-9=?A-Z^_`a
 -z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
 $email_address))

One problem (syntax issues aside) is that it doesn't seem to be checking
for anything remotely similar to a valid email address.

Here's what we use. Not 100% perfect but closer than most, I think:

function validate_email ($addr)
{
  return

preg_match('/^[^\'\s,;]+([a-z0-9]+[a-z0-9\-]*\.)+[a-z0-9]+[a-z0-9\-]*[a-z0-9]+$/i',
  trim($addr)));
}

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-16 Thread Liam Gibbs

Thanks to all who helped out with the eregi(mail)
stuff. I got my problem solved, and on top of that,
there were some bugs that I found in the code. Thanks
again to everyone.


__
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] eregi(mail)

2002-05-10 Thread Liam Gibbs

Does anyone have a decent eregi statement for
validating e-mail addresses? I've tried the ones on
the site, but there seems to be small bugs with each
of them. They tell me that [EMAIL PROTECTED] is an
invalid e-mail address.

__
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-10 Thread Analysis Solutions

Hi Liam:

On Fri, May 10, 2002 at 09:48:58AM -0700, Liam Gibbs wrote:
 Does anyone have a decent eregi statement for
 validating e-mail addresses?

eregi('^[a-z0-9_.=+-]+([a-z0-9-]+\.)+([a-z]{2,6})$', $Email);

Enjoy,

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-10 Thread Miguel Cruz

On Fri, 10 May 2002, Liam Gibbs wrote:
 Does anyone have a decent eregi statement for
 validating e-mail addresses? I've tried the ones on
 the site, but there seems to be small bugs with each
 of them. They tell me that [EMAIL PROTECTED] is an
 invalid e-mail address.

Well, it currently is an invalid email address (NXDOMAIN fdsf.net).
Perhaps the functions you've tried are doing lookups on the domain portion
of the address?

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-10 Thread Kevin Stone

I had always been suspicious about email validators so I did a big long
search on Google about standard address formats.  It turns out that aside
from the @ symbol emails have no standard format whatsoever.  So ereg('@',
$email) is really the only functional email validator.

You also have to think about what kind of email validation you need.  Do you
really need to control the format of the emails being stored in your
database?  Or do you need to control the validity of the emails being stored
in your database?  There is a big difference.  A valid email address isn't
necessarily one that is formated in the way you expect.  It is one that is
active and can be mailed to.  There are a number of techniques you can use
to determine that.

Well.. anyway sorry for going off on a tangent there.  In your search for an
email validator you got a bit more information than you expected.  I hope it
was useful in some tiny miniscule sort of way.  :)

--
Kevin Stone
[EMAIL PROTECTED]


- Original Message -
From: Analysis  Solutions [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Friday, May 10, 2002 10:59 AM
Subject: Re: [PHP] eregi(mail)


 Hi Liam:

 On Fri, May 10, 2002 at 09:48:58AM -0700, Liam Gibbs wrote:
  Does anyone have a decent eregi statement for
  validating e-mail addresses?

 eregi('^[a-z0-9_.=+-]+@([a-z0-9-]+\.)+([a-z]{2,6})$', $Email);

 Enjoy,

 --Dan

 --
PHP classes that make web design easier
 SQL Solution  |   Layout Solution   |  Form Solution
 sqlsolution.info  | layoutsolution.info |  formsolution.info
  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-10 Thread Steve Buehler


function check_input($array){
 global $HTTP_REFERER;
 $valid = 1;
 if(gettype($array)==array) {
 while (list($index, $subarray) = each($array) ) {
 if(ereg(required_, $index)  (($subarray == ) 
|| ($subarray ==  ))) {
 $index = ereg_replace(required_,  , 
$index);
 $index = ereg_replace(_,  , $index);
 echo
There is a problem with your submission. The field $index is required, 
please go back and fill in the form. (Or press the back button on your browser)
;
 $valid = 0;
 return 0;
 exit;
 }elseif(eregi(email, $index)){
 
if(ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
 
$subarray)){
 $email_check = 1;
 }else{
 $index = ereg_replace(required_, 
 , $index);
 echo
There is a problem with your submission. The E-mail address you provided, 
$subarray, does not appear to be valid, please go back and give a valid 
address. (Or press the back button on your browser)
;
 return 0;
 exit;
 }
 }else{
 $email_check = 10;
 }
 }
 if($valid == 1  ($email_check == 1 || $email_check 
== 10)) {
 return 1;
 }else{
 return 0;
 }
 }
}



At 11:48 AM 5/10/2002, you wrote:
Does anyone have a decent eregi statement for
validating e-mail addresses? I've tried the ones on
the site, but there seems to be small bugs with each
of them. They tell me that [EMAIL PROTECTED] is an
invalid e-mail address.

__
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] eregi(mail)

2002-05-10 Thread Miguel Cruz

On Fri, 10 May 2002, Kevin Stone wrote:
 I had always been suspicious about email validators so I did a big long
 search on Google about standard address formats.  It turns out that aside
 from the  symbol emails have no standard format whatsoever.  So ereg('',
 $email) is really the only functional email validator.

There is a format. See:

   http://www.merit.edu/internet/documents/rfc/rfc0822.txt

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-10 Thread Miguel Cruz

On Fri, 10 May 2002, Steve Buehler wrote:
 
if(ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.''.'[-!#$%\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
 

If I'm reading it correctly, this will let invalid addresses through. The
domain component (after the  sign) can only contain a-zA-Z0-9\.\-

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-10 Thread Analysis Solutions

Folks:

On Fri, May 10, 2002 at 01:27:45PM -0500, Steve Buehler wrote:
 
 
if(ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.''.'[-!#$%\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
 
 $subarray)){

Those characters don't conform to the RFC.

Miguel, thanks for posting the RFC (in the prior email).  That's what I based my ereg 
on (as shown in yet another earlier email).

Enjoy,

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-10 Thread Steve Buehler

Either Google is wrong (probably) or they are now allowing things like 
spaces into an email address.  There are actually several things that are 
not allowed in a standard email address.  Here is the code that I use.
ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
 
$subarray))
I am honestly not sure where I got this code, but it has always worked for 
me and I have not found any YET that are good address that this kills.  I 
have also not found any bad ones YET that this lets through (unless the 
domain or user doesn't exist, of course).

Steve

At 01:26 PM 5/10/2002, you wrote:
I had always been suspicious about email validators so I did a big long
search on Google about standard address formats.  It turns out that aside
from the @ symbol emails have no standard format whatsoever.  So ereg('@',
$email) is really the only functional email validator.

You also have to think about what kind of email validation you need.  Do you
really need to control the format of the emails being stored in your
database?  Or do you need to control the validity of the emails being stored
in your database?  There is a big difference.  A valid email address isn't
necessarily one that is formated in the way you expect.  It is one that is
active and can be mailed to.  There are a number of techniques you can use
to determine that.

Well.. anyway sorry for going off on a tangent there.  In your search for an
email validator you got a bit more information than you expected.  I hope it
was useful in some tiny miniscule sort of way.  :)

--
Kevin Stone
[EMAIL PROTECTED]


- Original Message -
From: Analysis  Solutions [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Friday, May 10, 2002 10:59 AM
Subject: Re: [PHP] eregi(mail)


  Hi Liam:
 
  On Fri, May 10, 2002 at 09:48:58AM -0700, Liam Gibbs wrote:
   Does anyone have a decent eregi statement for
   validating e-mail addresses?
 
  eregi('^[a-z0-9_.=+-]+@([a-z0-9-]+\.)+([a-z]{2,6})$', $Email);
 
  Enjoy,
 
  --Dan
 
  --
 PHP classes that make web design easier
  SQL Solution  |   Layout Solution   |  Form Solution
  sqlsolution.info  | layoutsolution.info |  formsolution.info
   T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
   4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-10 Thread Steve Buehler

To tell you the truth, I can't read it.

Steve

At 01:32 PM 5/10/2002, Miguel Cruz wrote:
On Fri, 10 May 2002, Steve Buehler wrote:
  
 
if(ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.''.'[-!#$%\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
 


If I'm reading it correctly, this will let invalid addresses through. The
domain component (after the  sign) can only contain a-zA-Z0-9\.\-

miguel


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-10 Thread Kevin Stone

As we all know ARPA is thet university network, funded by the government to
build an information infrastructure that eventually became the internet we
have today.  But the standards for text messaging within the ARPA net have
been added to over the years in order to accomodate ever expanding
requirments.

For example I have read that a valid email needn't necessarily require
anything before the @ symbol.  The ARPA RFC specifically states that it
does.  But [EMAIL PROTECTED] can be just as valid as @foo.bar.com  if the the
domain resolves and the server is setup to parse from a catch all account
named ''.  Is this not true?

If this is true then eregi(/^[a-z0-9]+/, $email ) wouldn't necessarily be
valid.  We could then say that eregi(/^[a-z0-9]*/, $email) is pointless
becuase if nothing has to be there then there isn't any reason to look for
it.  And thus we return to the original assertion that ereg('@', $email) is
the only way to know that the string is a properly formated email address.

So why even validate that format beyond the most basic rules (@, length, and
invalid characters)?   The result of which is useless, unless the address is
sendable, in which case the string format is irrelevant.
-Kevin

- Original Message -
From: Miguel Cruz [EMAIL PROTECTED]
To: Kevin Stone [EMAIL PROTECTED]
Cc: PHP-general [EMAIL PROTECTED]
Sent: Friday, May 10, 2002 12:30 PM
Subject: Re: [PHP] eregi(mail)


 On Fri, 10 May 2002, Kevin Stone wrote:
  I had always been suspicious about email validators so I did a big long
  search on Google about standard address formats.  It turns out that
aside
  from the @ symbol emails have no standard format whatsoever.  So
ereg('@',
  $email) is really the only functional email validator.

 There is a format. See:

http://www.merit.edu/internet/documents/rfc/rfc0822.txt

 miguel





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] eregi(mail)

2002-05-10 Thread Nathan Cassano


This is what I have used.

?
if(eregi(^[_.+a-z0-9-]+@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})\$,
$email)){
echo Good Email!;
}
?


Here is an excellent article on Regular Expressions.

Learning to Use Regular Expressions by Example
http://www.phpbuilder.com/columns/dario19990616.php3


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] eregi(mail)

2002-05-10 Thread Miguel Cruz

On Fri, 10 May 2002, Kevin Stone wrote:
 As we all know ARPA is thet university network, funded by the government
 to build an information infrastructure that eventually became the
 internet we have today.  But the standards for text messaging within the
 ARPA net have been added to over the years in order to accomodate ever
 expanding requirments.

Yes, and those changes are codified into new RFCs which eventually become
standards. By all means have a look at RFC 2822 which, if passed into use,
will obsolete 822.

 For example I have read that a valid email needn't necessarily require
 anything before the @ symbol.  The ARPA RFC specifically states that it
 does.  But [EMAIL PROTECTED] can be just as valid as @foo.bar.com  if the the
 domain resolves and the server is setup to parse from a catch all account
 named ''.  Is this not true?

Sure, and if a web server is set up to respond to a request like:

   SPLEARGH www.boogermax.com/greebles ? 888 *** 3424235667

then web browsers could send it and get something in return, but it 
doesn't mean it's a valid HTTP request.

 If this is true then eregi(/^[a-z0-9]+/, $email ) wouldn't necessarily be
 valid.  We could then say that eregi(/^[a-z0-9]*/, $email) is pointless
 becuase if nothing has to be there then there isn't any reason to look for
 it.  And thus we return to the original assertion that ereg('@', $email) is
 the only way to know that the string is a properly formated email address.

Properly formatted email address is a term whose meaning derives from a
prescriptive, rather than descriptive, definition. A properly-formatted 
email address is one which has been properly formatted in accordance with 
the rules governing mail addressing, and nothing any more arbitrary than 
that.

 So why even validate that format beyond the most basic rules (@, length, and
 invalid characters)?   The result of which is useless, unless the address is
 sendable, in which case the string format is irrelevant.

Why even look for an @ sign then? I can address a message to 'mnc' and it
will arrive just fine - within my zone of control.

The reason that we use standards is to ensure that hardware and software 
from various vendors can communicate with each other without unexpected 
results. As soon as you start giving that up, you subdivide the internet 
into smaller zones of mutual compatibility. About 99.9% of the time, there 
is no constructive reason for doing it. Given the flexibility already 
allowed in email addressesing, I certainly don't see this as one of the 
exceptions.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php