Re: eregi(mail)
| From: | Steve Buehler | Date: | Fri, 10 May 2002 18:27:45 +0000 |
| Subject: | Re: eregi(mail) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-96978@lists.php.net to get a copy of this message | ||
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 fdsjklfsd@fdsf.net 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