Advertisement
SRD75

send.php

Sep 19th, 2012
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. <?php
  2. error_reporting(E_NOTICE);
  3.  
  4. function valid_email($str)
  5. {
  6. return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
  7. }
  8.  
  9. if($_POST['first_name']!='' && $_POST['last_name']!='' && $_POST['e_mail']!='' && $POST['phone']!='' && valid_email($_POST['e_mail'])==TRUE)
  10. {
  11. $headers = 'From: '.$_POST['e_mail'].''. "\r\n" .
  12. 'Reply-To: '.$_POST['e_mail'].'' . "\r\n" .
  13. 'X-Mailer: PHP/' . phpversion();
  14. $subject = "Contact from IC website";
  15. $message = 'Name: ' . $_POST['first_name'].' '. $POST['last_name'] . "\r\n" .
  16. 'Phone: ' . $POST['phone'] . "\r\n" .
  17. 'Referred by: ' . $POST['referred_by'] . "\r\n" .
  18. 'Event type: ' . $POST['event_type'] . "\r\n" .
  19. 'Event date: ' . $POST['event_date'] . "\r\n" .
  20. 'Venue: ' . $POST['venue'] . "\r\n" .
  21. 'Number of guests: ' . $POST['num_guests'] . "\r\n" .
  22. 'Budget: ' . $POST['budget'] . "\r\n" .
  23. 'Decor required: ' . "\r\n" .
  24. ' Entry: ' . $POST['entry'] . "\r\n" .
  25. ' Dance floor: ' . $POST['dance_floor'] . "\r\n" .
  26. ' Stage: ' . $POST['stage'] . "\r\n" .
  27. ' Ceiling: ' . $POST['ceiling'] . "\r\n" .
  28. ' Table: ' . $POST['table'] . "\r\n" .
  29. htmlspecialchars($_POST['themessage']);
  30.  
  31. if(mail($to, $subject, $message, $headers))
  32. {//we show the good guy only in one case and the bad one for the rest.
  33. echo 'Thank you '.$_POST['first_name'].'. Your message was sent';
  34. }
  35. else {
  36. echo "Message not sent. Please make sure you're not
  37. running this on localhost and also that you
  38. are allowed to run mail() function from your webserver";
  39. }
  40. }
  41. else {
  42. echo 'Please make sure you filled all the required fields,
  43. and that you entered a valid email and phone.';
  44. }
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement