Advertisement
Guest User

Untitled

a guest
Oct 19th, 2014
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. "; echo $error."
  2.  
  3. "; echo "Please go back and fix these errors.
  4.  
  5. "; die(); } // validation expected data exists if(!isset($_POST['user_name']) || !isset($_POST['sum']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['user_name']; // required $telephone = $_POST['sum']; //required $comments = $_POST['comments']; // required $error_message = ""; $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$user_name)) { $error_message .= 'The Username you entered does not appear to be valid.
  6. '; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.
  7. '; } 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); } $email_message .= "User Name: ".clean_string($user_name)."\n"; $email_message .= "Summary: ".clean_string($sum)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> Thank you for contacting us. We will be in touch with you very soon.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement