",",","?","/",",","{","}","[","]","`","~","'","=","+",'"',":",";"," "); for ($i=0;$i50){ return false; } return $valid; } function addtodb($first, $last, $title, $company, $department, $address, $address2, $city, $state, $zip, $country, $phone, $fax, $email, $contact, $message, $products, $sample){ $query = mysql_query("INSERT INTO contact (date, first, last, title, company, department, address, address2, city, state, zip, country, phone, fax, email, contact, message, product_interest, sample) VALUES ('".date('Y-m-d')."', '".$first."', '".$last."', '".$title."', '".$company."', '".$department."', '".$address."', '".$address2."', '".$city."', '".$state."', '".$zip."', '".$country."', '".$phone."', '".$fax."', '".$email."', '".$contact."', '".$message."', '".$products."', '".$sample."')") or die(mysql_error()); return $query; } if($_POST['send']) { if(strlen($_POST['field0'])<2) { $error .= "
  • You must provide your First Name.
  • "; $name_error = true; } if(strlen($_POST['field5'])<2) { $error .= "
  • You must provide your Last Name.
  • "; $last_name_error = true; } if(strlen($_POST['phone'])<1){ $error .= "
  • You must provide a phone number.
  • "; $phone_error = true; } if($_POST['phone']) { $submobile=preg_replace("/[^0-9]/", "", $_POST['phone']); if(strlen($submobile)!=10) { $error .= "
  • The phone number you have provided is invalid or incomplete.
  • "; $phone_error = true; } } if(strlen($_POST['email'])<1) { $error .= "
  • You must provide an email address.
  • "; $email_error = true; } if(strlen($_POST['email'])>0 && !validateEmail($_POST['email'], 1)) { $error .= "
  • The email address you have provided is invalid or incomplete.
  • "; $email_error = true; } if($_POST['field15']=="") { $error .= "
  • You must select the best way to contact you.
  • "; $contact_error = true; } if($error) { unset($_POST['send']); } else { $to = "pbergad@bergad.com"; $from = $_POST["email"]; $subject = "From the Website"; $plain_text = "The following message/request for information was sent through the website, ".date("F j, Y, g:i a").": FROM: ".stripslashes($_POST["field0"])." ".stripslashes($_POST["field5"])." "; if($_POST["field6"]){$plain_text .=stripslashes($_POST["field6"])." ";} if($_POST["field7"]){ $plain_text .=stripslashes($_POST["field8"])." ";} if($_POST["field8"]){ $plain_text .=stripslashes($_POST["field7"])." ";} $plain_text .=" CONTACT INFORMATION: "; if($_POST["field15"]){ $plain_text .="Please contact this user via ".$_POST["field15"].". ";} if($_POST["field9"]){ $plain_text .=stripslashes($_POST["field9"])." ";} if($_POST["field10"]){ $plain_text .=stripslashes($_POST["field10"])." ";} if($_POST["field11"]){ $plain_text .=stripslashes($_POST["field11"]).", ";} if($_POST["field12"]){ $plain_text .=stripslashes($_POST["field12"])." ";} if($_POST["field13"]){ $plain_text .=stripslashes($_POST["field13"])." ";} if($_POST["field14"]){ $plain_text .=stripslashes($_POST["field14"])." ";} $plain_text .=" ".$_POST["email"]." "; $plain_text .=stripslashes($_POST["phone"]); if($_POST["ext"]){$plain_text .=" ext. ".$_POST['ext'];} $plain_text .=" "; if($_POST["fax"]){ $plain_text .=stripslashes($_POST["fax"])." - fax ";} $plain_text .=" MESSAGE: "; if($_POST["field2"]){ $plain_text .=stripslashes($_POST["field2"])." ";} if($_POST["field16"] || $_POST["field17"] || $_POST["field18"] || $_POST["field19"] || $_POST["field20"] || $_POST["field21"] || $_POST["field22"] || $_POST["field23"] || $_POST["field24"] || $_POST["field25"] || $_POST["field26"]){$plain_text .=" PRODUCTS OF INTEREST INCLUDE: ";} if($_POST["field16"]){ $plain_text .=$_POST["field16"]." ";} if($_POST["field17"]){ $plain_text .=$_POST["field17"]." ";} if($_POST["field18"]){ $plain_text .=$_POST["field18"]." ";} if($_POST["field19"]){ $plain_text .=$_POST["field19"]." ";} if($_POST["field20"]){ $plain_text .=$_POST["field20"]." ";} if($_POST["field21"]){ $plain_text .=$_POST["field21"]." ";} if($_POST["field22"]){ $plain_text .=$_POST["field22"]." ";} if($_POST["field23"]){ $plain_text .=$_POST["field23"]." ";} if($_POST["field24"]){ $plain_text .=$_POST["field24"]." ";} if($_POST["field25"]){ $plain_text .=$_POST["field25"]." ";} if($_POST["field26"]){ $plain_text .="other: ".$_POST["field27"]." ";} if($_POST["field28"]){ $plain_text .=" THIS CUSTOMER HAS REQUESTED A SAMPLE PACK.";} $submitted = "The following message/request for information was sent through the website, ".date("F j, Y, g:i a").":

    FROM:
    ".stripslashes($_POST["field0"])." ".stripslashes($_POST["field5"])."
    "; if($_POST["field6"]){$submitted .=stripslashes($_POST["field6"])."
    ";} if($_POST["field7"]){ $submitted .=stripslashes($_POST["field8"])."
    ";} if($_POST["field8"]){ $submitted .=stripslashes($_POST["field7"])."
    ";} $submitted .="
    CONTACT INFORMATION:
    "; if($_POST["field15"]){ $submitted .="Please contact this customer via ".$_POST["field15"].".

    ";} if($_POST["field9"]){ $submitted .=stripslashes($_POST["field9"])."
    ";} if($_POST["field10"]){ $submitted .=stripslashes($_POST["field10"])."
    ";} if($_POST["field11"]){ $submitted .=stripslashes($_POST["field11"]).", ";} if($_POST["field12"]){ $submitted .=stripslashes($_POST["field12"])." ";} if($_POST["field13"]){ $submitted .=stripslashes($_POST["field13"])." ";} if($_POST["field14"]){ $submitted .=stripslashes($_POST["field14"])."
    ";} $submitted .="
    ".$_POST["email"]."
    "; $submitted .=stripslashes($_POST["phone"]); if($_POST["ext"]){$submitted .=" ext. ".$_POST['ext'];} $submitted .="
    "; if($_POST["fax"]){ $submitted .=stripslashes($_POST["fax"])." (fax)
    ";} $submitted .="
    MESSAGE:
    "; if($_POST["field2"]){ $submitted .=stripslashes($_POST["field2"])."
    ";} if($_POST["field16"] || $_POST["field17"] || $_POST["field18"] || $_POST["field19"] || $_POST["field20"] || $_POST["field21"] || $_POST["field22"] || $_POST["field23"] || $_POST["field24"] || $_POST["field25"] || $_POST["field26"]){$submitted .="
    PRODUCTS OF INTEREST INCLUDE:
    ";} if($_POST["field16"]){ $submitted .=$_POST["field16"]."
    ";} if($_POST["field17"]){ $submitted .=$_POST["field17"]."
    ";} if($_POST["field18"]){ $submitted .=$_POST["field18"]."
    ";} if($_POST["field19"]){ $submitted .=$_POST["field19"]."
    ";} if($_POST["field20"]){ $submitted .=$_POST["field20"]."
    ";} if($_POST["field21"]){ $submitted .=$_POST["field21"]."
    ";} if($_POST["field22"]){ $submitted .=$_POST["field22"]."
    ";} if($_POST["field23"]){ $submitted .=$_POST["field23"]."
    ";} if($_POST["field24"]){ $submitted .=$_POST["field24"]."
    ";} if($_POST["field25"]){ $submitted .=$_POST["field25"]."
    ";} if($_POST["field26"]){ $submitted .="other: ".$_POST["field27"]."
    ";} if($_POST["field28"]){ $submitted .="
    THIS CUSTOMER HAS REQUESTED A SAMPLE PACK.";} $html_text ="\r\n"; $html_text .=$submitted."\r\n"; $html_text .=""; $boundary = uniqid('np'); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Subject: ".$subject."\r\n"; $headers .= "From: ".$_POST['fullname']." <".$_POST["email"].">\r\n"; $headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n"; $body = "This is a MIME encoded body."; $body .= "\r\n\r\n--" . $boundary . "\r\n"; $body .= "Content-type: text/plain;charset=iso-8859-1\r\n\r\n"; $body .= $plain_text; $body .= "\r\n\r\n--" . $boundary . "\r\n"; $body .= "Content-type: text/html;charset=iso-8859-1\r\n\r\n"; $body .= $html_text; $body .= "\r\n\r\n--" . $boundary . "--"; /*if (file_exists("/usr/local/scripts/safeMail.php")){ include("/usr/local/scripts/safeMail.php"); safeMail($to, $from, $subject, $body, $headers, $PHP_SELF, $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_REFERER'], $_POST["field4"], false, false); } else*/ if(!$_POST['field4']) { mail($to, $subject, $body, $headers); $sent=true;} $start = false; if ($_POST['field16']){ $start=true; $products .= $_POST['field16']; } if ($_POST['field17']){ if ($start){ $products.=", "; } $start=true; $products .= $_POST['field17']; } if ($_POST['field18']){ if ($start){ $products.=", "; } $start=true; $products .= $_POST['field18']; } if ($_POST['field19']){ if ($start){ $products.=", "; } $start=true; $products .= $_POST['field19']; } if ($_POST['field20']){ if ($start){ $products.=", "; } $start=true; $products .= $_POST['field20']; } if ($_POST['field21']){ if ($start){ $products.=", "; } $start=true; $products .= $_POST['field21']; } if ($_POST['field22']){ if ($start){ $products.=", "; } $start=true; $products .= $_POST['field22']; } if ($_POST['field23']){ if ($start){ $products.=", "; } $start=true; $products .= $_POST['field23']; } if ($_POST['field24']){ if ($start){ $products.=", "; } $start=true; $products .= $_POST['field24']; } if ($_POST['field25']){ if ($start){ $products.=", "; } $start=true; $products .= $_POST['field25']; } if ($_POST['field26']){ if ($start){ $products.=", "; } $start=true; $products .= "other: ".$_POST['field27']; } $submobile=preg_replace("/[^0-9]/", "", $_POST['phone']); $phone1=substr($submobile, 0, 3); $phone2=substr($submobile, 3, 3); $phone3=substr($submobile, 6, 4); $phone = $phone1."-".$phone2."-".$phone3; if($_POST["ext"]){ $phone .=" ext. ".$_POST["ext"]; } if($_POST['fax']){ $submobile2=preg_replace("/[^0-9]/", "", $_POST['fax']); $fax1=substr($submobile2, 0, 3); $fax2=substr($submobile2, 3, 3); $fax3=substr($submobile2, 6, 4); $fax = $fax1."-".$fax2."-".$fax3; } else{ $fax = ""; } if ($_POST["field28"]){ $sample = 1; } else{ $sample = 0; } if($sent) { addtodb($_POST["field0"], $_POST["field5"], $_POST["field6"], $_POST["field7"], $_POST["field8"], $_POST["field9"], $_POST["field10"], $_POST["field11"], $_POST["field12"], $_POST["field13"], $_POST["field14"], $phone, $fax, $_POST["email"], $_POST["field15"], $_POST["field2"], $products, $sample); } } } ?> Contact Us — Bergad Specialty Foams & Composites