purify($_POST['contact_name']));
$clean_phone = addslashes($purifier->purify( $_POST['contact_phone']));
$clean_email = addslashes($purifier->purify($email = $_POST['contact_email']));
$clean_desc = addslashes($purifier->purify($_POST['contact_desc']));
$clean_check_web = addslashes($purifier->purify( $_POST['contact_web'])) ;
$clean_check_dev = addslashes($purifier->purify( $_POST['contact_dev']));
$clean_check_media = addslashes($purifier->purify( $_POST['contact_media']));
$clean_desc_wrapped = wordwrap($clean_desc, 100, "\n", true);
$ip=mysql_real_escape_string($purifier->purify($_SERVER['REMOTE_ADDR']));
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////// THE EMAIL THAT WILL BE SENT /////////////////////////
$body = "A new web form contact request has been receieved:
\n Name: ".$clean_name."
\n Phone Number: ".$clean_phone."
\n Email Address: ".$clean_email."
\n Interested registered in:
\n".$clean_check_web.",".$clean_check_dev.",".$clean_check_media."
\n".$clean_desc_wrapped;
////////////////////////////////////////////////////////////////////////
if ($clean_name && $clean_phone && $clean_email) {
$check = mysql_query("SELECT timestamp FROM contact WHERE ip = '".$ip."';");
if (mysql_num_rows($check)){
$last_post = strtotime(mysql_result($check,0));
$time_now = time();
if(($time_now - $last_post) > 3600 ) {
mail('Sales@sneakybox.com', "WEBSITE REQUEST FORM FROM $ip", $body);
mysql_query("UPDATE contact SET timestamp = CURRENT_TIMESTAMP WHERE ip = '".$ip."';");
echo "Thanks! A memeber of our team will be in touch as soon as possible! Back to Sneakybox";
die;
}
else{ echo "You've already sent a request!
If you'd like to add any further information please email info@sneakybox.com
Back to Sneakybox";
die;
}
}
else{
mail('Sales@sneakybox.com', "WEBSITE REQUEST FORM FROM $ip", $body);
mysql_query("INSERT INTO contact(timestamp,ip) VALUES(CURRENT_TIMESTAMP,'".$ip."');");
echo "Thanks! A memeber of our team will be in touch as soon as possible! Back to Sneakybox";
die;
}
}
echo "Sorry, All fields in the form are required. Our Javascript validator should have picked this up before submitting but it looks like you have javascript disabled.
Back to Sneakybox";
die;
?>