Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EREG()

Status
Not open for further replies.

tobyheywood

IS-IT--Management
Apr 20, 2001
122
GB
Hello,

The follow snippet of code is (was) used to check for carriage returns (\r) and newlines (\n) in an email address entered by a user.

For some reason this now always evaluates $efrom as containing a \r or \n. I see no reason why the form data would contain these and am hoping someone can shed some light on this.

<- CODE WHICH STORES FORM VARIABLES ->
Code:
$visitor['Name'] = addslashes($_POST['Name']);
$visitor['Email'] = addslashes($_POST['Email']);
$visitor['Tel'] = addslashes($_POST['Telephone']);
<- CODE TO CHECK EMAIL ADDRESS ->
Code:
$efrom = stripslashes($visitor['Email']);
if (ereg("\\r",$efrom) || ereg("\\n",$efrom) ) {
	$messageok = '0';
	// This is always returned
} else {
	$messageok = '1';
}

Removal of the above email checking code, results in the email being sent successfully.

Any help would be appreciated.

Regards

Toby Heywood

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top