$feed_first = filter_input(INPUT_POST, "feed_first", FILTER_SANITIZE_STRING);
$feed_last= filter_input(INPUT_POST, "feed_last", FILTER_SANITIZE_STRING);
$feed_phone= filter_input(INPUT_POST, "feed_phone", FILTER_SANITIZE_STRING);
$form_email= filter_input(INPUT_POST, "form_email", FILTER_SANITIZE_STRING);
$feed_comments= filter_input(INPUT_POST, "feed_comments", FILTER_SANITIZE_STRING);
$Code= filter_input(INPUT_POST, "Code", FILTER_SANITIZE_STRING);
if(isset($_POST['form_email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "more.info@foreverjoy.net";
$femail= "noreply@foreverjoy.net";
#$femail= "webmaster@oldcabin.net";
$email_subject = "Forever Joy Web site Request";
function died($error) {
echo "
“; echo “Please go back and correct these errors:
“; echo “You must enter the security code or the Code is incorrect: You entered ‘ . $Code . ‘. The correct code is ‘. $code2 .’ and the code is CASE Sensitive ‘;
}
$string_exp = “/^[A-Za-z .’-]+$/”;
if ($iprefer !== $contact_url) {
$error_message .= ‘You are trying to call this form from an unauthorized URL. How come? ‘;
}
$string_exp = “/^[A-Za-z .’-]+$/”;
if(!preg_match($string_exp,$feed_first)) {
$error_message .= ‘The first name you entered does not appear to be valid. ‘;
}
if(!preg_match($string_exp,$feed_last)) {
$error_message .= ‘The last name you entered does not appear to be valid. ‘;
}
//do nothing for phone as not required
$email_exp = ‘/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/’;
if(!preg_match($email_exp,$form_email)) {
$error_message .= ‘The email address you entered does not appear to be valid. ‘;
}
if(strlen($error_message) > 0) {
died($error_message);
}else{
echo “
“; echo “We will be in touch with you very soon.
“; echo “
“; echo ““; echo ““; $email_message = “$email_subject \n”; $email_message .= “\n”; $email_message .= “************************************************************* \n”; $email_message .= “First name: “.clean_string($feed_first).”\n”; $email_message .= “Last name: “.clean_string($feed_last).”\n”; $email_message .= “Phone: “.clean_string($feed_phone).”\n”; $email_message .= “Email address: “.clean_string($form_email).”\n\n”; $email_message .= “Questions: “.clean_string($feed_comments).”\n\n”; $email_message .= “IP Address: “.$realip.”\n”; // create email headers $headers = ‘From: ‘.$femail.”\r\n”. ‘Reply-To: ‘.$form_email.”\r\n” . ‘X-Mailer: PHP/’ . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); } } ?>
We are very sorry, but there were error(s) found with the form you submitted
“; echo ““; echo “Please go back and correct these errors:
“; echo “
- “;
echo $error;
echo “
Thank you for your inquiry
“; echo ““; echo “We will be in touch with you very soon.
“; echo “
“; echo ““; echo ““; $email_message = “$email_subject \n”; $email_message .= “\n”; $email_message .= “************************************************************* \n”; $email_message .= “First name: “.clean_string($feed_first).”\n”; $email_message .= “Last name: “.clean_string($feed_last).”\n”; $email_message .= “Phone: “.clean_string($feed_phone).”\n”; $email_message .= “Email address: “.clean_string($form_email).”\n\n”; $email_message .= “Questions: “.clean_string($feed_comments).”\n\n”; $email_message .= “IP Address: “.$realip.”\n”; // create email headers $headers = ‘From: ‘.$femail.”\r\n”. ‘Reply-To: ‘.$form_email.”\r\n” . ‘X-Mailer: PHP/’ . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); } } ?>