[dev] Re: [cvs] commit: horde/lib Form.php

Michael J. Pawlowsky mikejp at videotron.ca
Tue Feb 4 10:59:42 PST 2003




Dont know about the PEAR implementation but I use

	function check_user_email($email, $check_dns = false){

		if((preg_match('/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/', $email)) || (preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/', $email)))
  		{
    		if($check_dns)
    		{
      			$host = explode('@', $email);
      			// Check for MX record
      			if( checkdnsrr($host[1], 'MX') ) return true;
      			// Check for A record
      			if( checkdnsrr($host[1], 'A') ) return true;
      			// Check for CNAME record
      			if( checkdnsrr($host[1], 'CNAME') ) return true;
    		} else {
      			return true;
    		}
  		}
  		return false;
	}




*********** REPLY SEPARATOR  ***********

On 04/02/2003 at 9:39 AM Eric Rostetter wrote:

>Quoting Marko Djukic <tech at oblo.com>:
>
>> mdjukic     2003/02/04 06:02:53 PST
>>
>>   Modified files:
>>     lib                  Form.php
>>   Log:
>>   if the email address has been submitted, even though it may not have
>been a
>> required field, nonetheless check that the email is a valid one.
>>
>>   anyone have any thoughts on putting in a more intelligent email check
>> rather than "has an @ char"?
>
>Mail_RFC822::parseAddressList() from PEAR (Mail/RFC822.php)?
>
>--
>Eric Rostetter
>The Department of Physics
>The University of Texas at Austin
>
>Why get even? Get odd!
>
>--
>Horde developers mailing list
>Frequently Asked Questions: http://horde.org/faq/
>To unsubscribe, mail: dev-unsubscribe at lists.horde.org


Cheers,
Mike
---------------------------------------------------------------------------------------------------------
Hlade's Law:	If you have a difficult task, give it to a lazy person --
		they will find an easier way to do it.





More information about the dev mailing list