Jump to content

problem with eregi function


xanie

Recommended Posts

this is my code and it appears that Deprecated: Function eregi() is deprecated in C:\wamp\www\ozlo_v4\send_contact.php"

can someone help me with this matter.. thanks. :)

 

<?php

 

if(!isset($_POST['first_name']) ||

!isset($_POST['captcha_code']) ||

!isset($_POST['email']) ||

!isset($_POST['telephone']) ||

 

!isset($_POST['comments'])) {

died('We are sorry, but there appears to be a problem with the form your submitted.');

}

 

$first_name = $_POST['first_name']; // required

$captcha_code = $_POST['captcha_code']; // required

$email_from = $_POST['email']; // required

$telephone = $_POST['telephone']; // not required

$product_name = $_POST['product_name']; // required

$comments = $_POST['comments']; // required

 

$error_message = "";

$email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";

if(!eregi($email_exp,$email_from)) {

$error_message .= 'The Email Address you entered does not appear to be valid.<br />';

}

$string_exp = "^[a-z .'-]+$";

if(!eregi($string_exp,$first_name)) {

$error_message .= 'The First Name you entered does not appear to be valid.<br />';

}

$string_exp = "^[a-z 0-9.'-]+$";

if(!eregi($string_exp,$captcha_code)) {

$error_message .= 'The Code you entered does not appear to be valid.<br />';

}

$string_exp = "^[a-z 0-9.'-]+$";

if(!eregi($string_exp,$product_name)) {

$error_message .= 'The Product Name you entered does not appear to be valid.<br />';

}

if(strlen($comments) < 2) {

$error_message .= 'The Comments you entered do not appear to be valid.<br />';

}

$string_exp = "^[0-9 .-]+$";

if(!eregi($string_exp,$telephone)) {

$error_message .= 'The Telphone Number you entered does not appear to be valid.<br />';

}

if(strlen($error_message) > 0) {

died($error_message);

}

$email_message = "Form details below.\n\n";

 

function clean_string($string) {

$bad = array("content-type","bcc:","to:","cc:","href");

return str_replace($bad,"",$string);

}

clean_string($first_name);

clean_string($lname);

$fullname = "$lname, $first_name";

$email_message .= "Name: ".$fullname."\n";

$email_message .= "captcha_code: ".clean_string($captcha_code)."\n";

$email_message .= "Email: ".clean_string($email_from)."\n";

$email_message .= "Telephone: ".clean_string($telephone)."\n";

$email_message .= "Company: ".clean_string($cname)."\n";

$email_message .= "Profession: ".clean_string($pro)."\n";

$email_message .= "Position: ".clean_string($pos)."\n";

$email_message .= "Product Name: ".clean_string($product_name)."\n";

$email_message .= "Message: ".clean_string($comments)."\n";

 

?>

bdhj.php

Link to comment
https://forums.phpfreaks.com/topic/272838-problem-with-eregi-function/
Share on other sites

Parse error:syntax error,unexpected 'or' (T_LOGICAL_OR) in config/db.php on line 2

 

here is my code.. tnx

 

<?php

 

 

$db=@mysql_connect('localhost', 'root', '')or die (mysql_error());

mysql_query("SET NAMES 'utf8'");

@mysql_select_db('ozlo',$db)or die (mysql_error());

 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.