$page_access = 0; include ("ssi/authorize.php"); $breadcrumb = "Home > Contact Form"; $pagename = "Contact Form"; //Load Countries $sql = "SELECT countryName FROM ajax_countries ORDER BY countryName"; $countries = mysql_query($sql); $un_countries = mysql_query($sql); if (isset($_POST["do_contact"])) { extract($_POST); if(!$cf_name) $prob["cf_name"] = true; if(!$cf_tel) $prob["cf_tel"] = true; if(!(preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/', $cf_email))) $prob["cf_email"] = true; $cf_query = trim($cf_query); // CAPTCHA SECURITY if(!$cf_code) { $prob["code1"] = true; } else { include_once 'tools/captcha/SPAF_FormValidator.class.php'; $obj = new SPAF_FormValidator(); if ($obj->validRequest($cf_code)) { $obj->destroy(); } else { $prob["code2"] = true; } } // CAPTCHA SECURITY END if (!$prob) { require("ssi/class.phpmailer.php"); //send email $cfmail = new phpmailer(); $cfmail->From = "$cf_email"; $cfmail->FromName = "$cf_name"; $cfmail->Subject = "$websitetitle - Contact Form - ".$cf_epurpose; $textemail = file_get_contents("admin/templates/contactformemail.txt"); $textemail = str_replace("!!!NAME!!!", $cf_name, $textemail); $textemail = str_replace("!!!COMPANY!!!", $cf_company, $textemail); $textemail = str_replace("!!!POSITION!!!", $cf_position, $textemail); $textemail = str_replace("!!!ADDRESS1!!!", $cf_address1, $textemail); $textemail = str_replace("!!!ADDRESS2!!!", $cf_address2, $textemail); $textemail = str_replace("!!!TOWN!!!", $cf_town, $textemail); $textemail = str_replace("!!!STATE!!!", $cf_state, $textemail); $textemail = str_replace("!!!COUNTRY!!!", $cf_country, $textemail); $textemail = str_replace("!!!TEL!!!", $cf_tel, $textemail); $textemail = str_replace("!!!MOBILE!!!", $cf_mobile, $textemail); $textemail = str_replace("!!!EMAIL!!!", $cf_email, $textemail); $textemail = str_replace("!!!HEAR!!!", $cf_hear, $textemail); $textemail = str_replace("!!!QUERY!!!", $cf_query, $textemail); $cfmail->IsHTML(false); $cfmail->Body = $textemail; $cfmail->AddAddress($owner_email, $websitetitle); // $cfmail->AddAddress("info@nmsdesigns.com", "Test Email"); if(!$cfmail->Send()) { $prob["mail"] = true; } else $sentok = true; } } else { if ($_GET["cfsubject"]) $cf_subject = $_GET["cfsubject"]; if($_SESSION["uid"]) { $cf_name = $_SESSION["fn"] . " (".$_SESSION["un"].")"; $cf_email = $_SESSION["em"]; } } ?>