1. <?php
  2.  
  3. $mailto = "info@tdmtransport.com";
  4. $subject = "Inquiry";
  5. $formurl = "http://www.tdmtransport.com/contact.html";
  6. $errorurl = "http://www.tdmtransport.com/error.html";
  7. $thankyouurl = "http://www.tdmtransport.com/thanks.html";
  8.  
  9. $email_is_required = 1;
  10. $name_is_required = 1;
  11. $comments_is_required = 0;
  12. $uself = 0;
  13. $use_envsender = 0;
  14. $use_sendmailfrom = 0;
  15. $use_webmaster_email_for_from = 0;
  16. $use_utf8 = 1;
  17. $my_recaptcha_private_key = '' ;
  18.  
  19. // -------------------- END OF CONFIGURABLE SECTION ---------------
  20.  
  21. $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
  22. $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ;
  23. if (!isset( $use_envsender )) { $use_envsender = 0 ; }
  24. if (isset( $use_sendmailfrom ) && $use_sendmailfrom) {
  25. ini_set( 'sendmail_from', $mailto );
  26. }
  27. $envsender = "-f$mailto" ;
  28. $first_name = $_POST['first_name']; // required
  29. $last_name = $_POST['last_name']; // required
  30. $company = $_POST['company']; // required
  31. $email_from = $_POST['email']; // required
  32. $phone = $_POST['phone']; // required
  33. $comodity = $_POST['comodity']; //required
  34. $truckload_or_ltl = $_POST['truckload_or_ltl']; //required
  35. $weight = $_POST['weight']; //required
  36. $trailer = $_POST['trailer']; //required
  37. $tarp = $_POST['tarp']; //not required
  38. $length_width_height = $_POST['length_width_height']; //not required
  39. $comments = $_POST['comments']; // not required
  40. $http_referrer = getenv( "HTTP_REFERER" );
  41.  
  42. if (!isset($_POST['email'])) {
  43. header( "Location: $formurl" );
  44. exit ;
  45. }
  46. if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($comments_is_required && empty($comments))) {
  47. header( "Location: $errorurl" );
  48. exit ;
  49. }
  50. if (strlen( $my_recaptcha_private_key )) {
  51. require_once( 'recaptchalib.php' );
  52. $resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
  53. if (!$resp->is_valid) {
  54. header( "Location: $errorurl" );
  55. exit ;
  56. }
  57. }
  58. if (empty($email)) {
  59. $email = $mailto ;
  60. }
  61. $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ;
  62.  
  63. if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) {
  64. $comments = stripslashes( $comments );
  65. }
  66.  
  67. $messageproper =
  68. "This message was sent from:\n" .
  69. "$http_referrer\n" .
  70. "------------------------------------------------------------\n" .
  71. "Name of sender: $fullname\n" .
  72. "Email of sender: $email\n" .
  73. "------------------------- COMMENTS -------------------------\n\n" .
  74. $comments .
  75. "\n\n------------------------------------------------------------\n" ;
  76.  
  77. $headers =
  78. "From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" .
  79. $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;
  80.  
  81. if ($use_envsender) {
  82. mail($mailto, $subject, $messageproper, $headers, $envsender );
  83. }
  84. else {
  85. mail($mailto, $subject, $messageproper, $headers );
  86. }
  87. header( "Location: $thankyouurl" );
  88. exit ;
  89.  
  90. ?>