Name!"; $missing_phone = "You did not enter your Phone Number!"; $missing_email = "You did not enter a valid E-mail Address!"; $thanks = "Thanks, ".$_POST['name'].".

\nYour Lifestyle Survey answers have been submitted successfully. One of our representatives will be in touch with you soon. Thanks again!"; $subject = "Lifestyle Survey Submission"; $content = "Hello, ".$_POST['name']." has submitted a Lifestyle Survey. Click here to login to the administrative area: ".$surveyAdmin." Regards, The Management"; // FUNCTIONS function getSqlRow($query) { $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); mysql_free_result($result); return $row; } function getSqlNumber($sqlQuery) { $query=mysql_query($sqlQuery); $result=mysql_num_rows($query); mysql_free_result($query); return $result; } function messageTable($message) { echo "
$message
"; exit; } function check_referer($referers) { if (count($referers)) { $found = false; $temp = explode("/",getenv("HTTP_REFERER")); $referer = $temp[2]; for ($x=0; $x < count($referers); $x++) { if (eregi ($referers[$x], $referer)) { $found = true; } } if (!getenv("HTTP_REFERER")) $found = false; if (!$found){ messageTable("You are coming from an unauthorized domain."); } return $found; } else { return true; // not a good idea, if empty, it will allow it. } } ?> :: Secure America :: 513.271.5500 ::
 
Skip to questions about:
Residential Security
Smart Home Networks
Audio / Video
Intercom
Central Vacuum
"; if ($_POST['name'] == '') { echo $missing_name; echo "
\n"; } if ($_POST['phone'] == '') { echo $missing_phone; echo "
\n"; } if (($_POST['email'] == '') || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $_POST['email']))) { echo $missing_email; echo "
\n"; } echo "
\n"; echo "
\n"; include_once ("surveyform.php"); } else { include_once ("preview.php"); } #################################### ### TRY TO SUBMIT THE DATA #################################### } else if ($_POST['action'] == 'submit') { //REFERRER CHECK // if ($referers) { // check_referer($referers); // } //ERROR CHECK if ($_POST['name'] == '' || $_POST['phone'] == '' || $_POST['email'] == '' || !eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $_POST['email'])) { echo "
"; if ($_POST['name'] == '') { echo $missing_name; echo "
\n"; } if ($_POST['phone'] == '') { echo $missing_phone; echo "
\n"; } if (($_POST['email'] == '') || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $_POST['email']))) { echo $missing_email; echo "
\n"; } echo "
"; echo "
\n"; include_once ("surveyform.php"); //SUBMIT DATA, SEND AN EMAIL, SAY THANKS } else { $insertSurvey = mysql_query("INSERT INTO surveys_surveys (name,phone,email,submitdate,recipient,homebuilder,lotnumber,subdivision,addlinfo,res_1,res_2,res_3,res_4,res_5,res_6,res_7,res_8,res_9,res_10,smart_1,smart_2,smart_3,smart_4,smart_5,smart_6,smart_7,smart_8,smart_9,smart_10,smart_11,smart_12,smart_13,smart_14,smart_15,smart_16,smart_17,smart_18,smart_19,smart_20,av_1,av_2,av_3,av_4,av_5,av_6,av_7,av_8,av_9,av_10,av_11,av_12,av_13,av_14,av_15,av_16,int_1,int_2,int_3,int_4,int_5,int_6,int_7,int_8,vac_1,vac_2,vac_3,vac_4,vac_5,vac_6,vac_7) VALUES ( '".addslashes($_POST['name'])."', '".addslashes($_POST['phone'])."', '".addslashes($_POST['email'])."', '".time()."', '".$_POST['recipient']."', '".addslashes($_POST['homebuilder'])."', '".addslashes($_POST['lotnumber'])."', '".addslashes($_POST['subdivision'])."', '".addslashes($_POST['addlinfo'])."', '".$_POST['res_1']."', '".$_POST['res_2']."', '".$_POST['res_3']."', '".$_POST['res_4']."', '".$_POST['res_5']."', '".$_POST['res_6']."', '".$_POST['res_7']."', '".addslashes($_POST['res_8'])."', '".addslashes($_POST['res_9'])."', '".$_POST['res_10']."', '".$_POST['smart_1']."', '".$_POST['smart_2']."', '".$_POST['smart_3']."', '".$_POST['smart_4']."', '".$_POST['smart_5']."', '".$_POST['smart_6']."', '".$_POST['smart_7']."', '".$_POST['smart_8']."', '".$_POST['smart_9']."', '".$_POST['smart_10']."', '".$_POST['smart_11']."', '".$_POST['smart_12']."', '".$_POST['smart_13']."', '".$_POST['smart_14']."', '".$_POST['smart_15']."', '".$_POST['smart_16']."', '".$_POST['smart_17']."', '".$_POST['smart_18']."', '".$_POST['smart_19']."', '".addslashes($_POST['smart_20'])."', '".$_POST['av_1']."', '".$_POST['av_2']."', '".$_POST['av_3']."', '".$_POST['av_4']."', '".$_POST['av_5']."', '".$_POST['av_6']."', '".$_POST['av_7']."', '".$_POST['av_8']."', '".$_POST['av_9']."', '".$_POST['av_10']."', '".$_POST['av_11']."', '".$_POST['av_12']."', '".$_POST['av_13']."', '".$_POST['av_14']."', '".$_POST['av_15']."', '".$_POST['av_16']."', '".$_POST['int_1']."', '".$_POST['int_2']."', '".$_POST['int_3']."', '".$_POST['int_4']."', '".$_POST['int_5']."', '".$_POST['int_6']."', '".$_POST['int_7']."', '".$_POST['int_8']."', '".$_POST['vac_1']."', '".$_POST['vac_2']."', '".$_POST['vac_3']."', '".$_POST['vac_4']."', '".$_POST['vac_5']."', '".$_POST['vac_6']."', '".$_POST['vac_7']."')"); if ($_POST['recipient'] != "") { $userEmail = getSqlRow("SELECT * FROM surveys_users WHERE display=1 AND id=".$_POST['recipient'].""); $recipientEmail = $userEmail['email']; } else { $recipientEmail = "info@secureamericainc.com"; } $tempinfo = "\n\n\n\n\n"; foreach ($_POST as $key=>$value) { $tempinfo .= $key.": ".$value."\n"; } mail($recipientEmail, $subject, $content.$tempinfo, "From: $fromemail\r\nReply-To: $email\r\nX-Mailer: DT_formmail"); messageTable($thanks); } #################################### ### SHOW THE FORM #################################### } else { include_once ("surveyform.php"); } ?>