Advertisement
Guest User

Untitled

a guest
Jul 13th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.30 KB | None | 0 0
  1. <html>
  2. <body>
  3. <?php
  4. if(isset($_POST['email'])) {
  5.     function died($error) {
  6.         echo "We are very sorry, but there were error(s) found with the form you submitted. ";
  7.         echo "These errors appear below.<br /><br />";
  8.         echo $error."<br /><br />";
  9.         echo "Please go back and fix these errors.<br /><br />";
  10.         die();
  11.     }
  12.     if(!isset($_POST['name']) ||
  13.         !isset($_POST['company']) ||
  14.         !isset($_POST['email']) ||
  15.         !isset($_POST['telephone']) ||
  16.         !isset($_POST['comments'])) {
  17.         died('We are sorry, but there appears to be a problem with the form you submitted.');
  18.     }
  19.     $name = $_POST['name'];
  20.     $company = $_POST['company'];
  21.     $email_from = $_POST['email'];
  22.     $telephone = $_POST['telephone'];
  23.     $comments = $_POST['comments'];
  24.     $error_message = "";
  25.     $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  26.   if(!preg_match($email_exp,$email_from)) {
  27.     $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  28.   }
  29.     $string_exp = "/^[A-Za-z .'-]+$/";
  30.   if(!preg_match($string_exp,$name)) {
  31.     $error_message .= 'The name you entered does not appear to be valid.<br />';
  32.   }
  33.   if(!preg_match($string_exp,$company)) {
  34.     $error_message .= 'The company you entered does not appear to be valid.<br />';
  35.   }
  36.   if(strlen($comments) < 2) {
  37.     $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  38.   }
  39.   if(strlen($error_message) > 0) {
  40.     died($error_message);
  41.   }
  42.     function clean_string($string) {
  43.       $bad = array("content-type","bcc:","to:","cc:","href");
  44.       return str_replace($bad,"",$string);
  45.     }
  46.  
  47.  
  48.   $service_url = 'https://COMPANY_NAME.quickbase.com/db/TABLE_ID?a=API_AddRecord&_fid_6=' . $name . '&ticket=' . $xml->ticket . '&apptoken=APPTOKEN' . '&_fid_7=' . $company . '&_fid_8=' . $email_from . '&_fid_9=' . $telephone . '&_fid_10=' . $comments . '';
  49.   $curl3 = curl_init($service_url);
  50.   curl_setopt($curl3, CURLOPT_RETURNTRANSFER, true);
  51.  
  52.   echo '<iframe id="test" style="display:none;" width=0 height=0 src="'.$service_url.'" visible=false></iframe>';
  53. ?>
  54.  
  55.  
  56.  
  57. <!-- include your own success html here -->
  58.  
  59.  
  60.  
  61. Thank you for contacting us. We will be in touch with you very soon.
  62.  
  63.  
  64.  
  65. <?php
  66.  
  67. }
  68.  
  69. ?>
  70. </body>
  71. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement