note 71910 rejected from function.eregi by betz

From: Date: Fri, 22 Dec 2006 11:15:00 +0000
Subject: note 71910 rejected from function.eregi by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-120847@lists.php.net to get a copy of this message
Note Submitter: webmaster at galofre dot net ---- I am using the eregi function but when combine with the explode function, it returns an invalid email. Even when the email is correct. Here is my code: if(empty($profile)) { $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = "quickForm.php?empty=true&dl=$newsletter"; header("Location: http://$host$uri/$extra"); exit; } else { $tmp = explode("\n", $profile); $firstname = $tmp[0]; $lastname = $tmp[1]; $Street = $tmp[2]; $City = $tmp[3]; $State = $tmp[4]; $Zip = $tmp[5]; $Country = $tmp[6]; $Email = $tmp[7]; $Phone = $tmp[8]; // do some basic error checking if(!empty($Email)) { // if there was some email address provided, then vet it if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $Email)) { $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = "quickForm.php?send=no&dl=$newsletter"; header("Location: http://$host$uri/$extra"); exit; } } Any ideas how to prevent this?

« previous php.notes (#120847) next »