note 48760 deleted from function.eregi by felipe

From: Date: Thu, 03 Jan 2008 01:40:05 +0000
Subject: note 48760 deleted from function.eregi by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134687@lists.php.net to get a copy of this message
Note Submitter: dompie at gmail dot com ---- @ mmc at nospam dot dk Nice thinking!! But just a slight remark. This function isn't so general as you say.. f.e.: example@yahoo.co.uk. Here is $regs[2] == yahoo.co , so 'Error: Can't find the host ' Therefor just a little change in the code: <? if( !eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@([a-z0-9]+([\.-][a-z0-9]{1,})+)*$", $mail, $regs) ) { echo "Error: '$mail' isn't a valid mail address!\n"; } elseif( gethostbyname($regs[2]) == $regs[2] ) { echo "Error: Can't find the host '$regs[2]'!<br>\n"; } ?> Now you have a fine working mail validation.. (as far as i know =) )

« previous php.notes (#134687) next »