"); } if ($_SERVER['REQUEST_METHOD'] == "POST") { function clean($data) { $data = trim(stripslashes(strip_tags($data))); return $data; } // lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score.. // score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam :) $points = (int)0; $badwords = array("adult", "beastial", "bestial", "blowjob", "clit", "cum", "cunilingus", "cunillingus", "cunnilingus", "cunt", "ejaculate", "fag", "felatio", "fellatio", "fuck", "fuk", "fuks", "gangbang", "gangbanged", "gangbangs", "hotsex", "hardcode", "jism", "jiz", "orgasim", "orgasims", "orgasm", "orgasms", "phonesex", "phuk", "phuq", "porn", "pussies", "pussy", "spunk", "xxx", "viagra", "phentermine", "tramadol", "adipex", "advai", "alprazolam", "ambien", "ambian", "amoxicillin", "antivert", "blackjack", "backgammon", "texas", "holdem", "poker", "carisoprodol", "ciara", "ciprofloxacin", "debt", "dating", "porn", "link=", "voyeur"); $exploits = array("content-type", "bcc:", "cc:", "document.cookie", "onclick", "onload", "javascript"); foreach ($badwords as $word) if (strpos($_POST['message'], $word) !== false) $points += 2; foreach ($exploits as $exploit) if (strpos($_POST['message'], $exploit) !== false) $points += 2; if (strpos($_POST['message'], "http://") !== false || strpos($_POST['message'], "www.") !== false) $points += 2; if (isset($_POST['nojs'])) $points += 1; if (preg_match("/(<.*>)/i", $_POST['message'])) $points += 2; if (strlen($_POST['name']) < 3) $points += 1; if (strlen($_POST['message']) < 15 || strlen($_POST['message'] > 1500)) $points += 2; // end score assignments foreach ($_POST as $key => $value) $_POST[$key] = trim($value); if (empty($_POST['firstname']) || empty($_POST['message']) || empty($_POST['lastname']) || empty($_POST['email'])) { $error_msg .= "Please fill in all the fields.\n"; } elseif ( (strlen($_POST['firstname']) > 25) || (strlen($_POST['lastname']) > 25)) { $error_msg .= "The name you entered is too long. Please try a shorter version.\n"; } elseif (!preg_match("/^[a-zA-Z-'\s]*$/", stripslashes($_POST['firstname']))) { $error_msg .= "The name field must not contain special characters. \n"; } elseif (!preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i', strtolower($_POST['email']))) { $error_msg .= "Please enter a valid e-mail address. \n"; } if ($error_msg == NULL && $points <= $maxPoints) { $subject = "Automatic Form Email"; $message = "You received this e-mail message through your website: \n\n"; foreach ($_POST as $key => $val) { if(ucwords($key)!='SEND') { $message .= ucwords($key) . ": " . clean($val) . "\r\n"; } } $message .= "\r\n \r\nAdditional Information:\r\n"; $message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n"; $message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\r\n"; if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) { $headers = "From: $yourEmail"; } else { $headers = "From: $yourEmail"; } if (mail($yourEmail,$subject,$message,$headers)) { if (!empty($thanksPage)) { header("Location: $thanksPage"); exit; } else { $result = 'Thank you, your message was sent.'; } } else { $error_msg = 'Your mail could not be sent this time.'; } } else { if (empty($error_msg)) $error_msg = 'Your mail looks too much like spam, and could not be sent this time. ['.$points.']'; } } function get_data($var) { if (isset($_POST[$var])) echo htmlspecialchars($_POST[$var]); } ?> Solang & Hansen: اتصل بنا

المكتب الرئيسي

Solang & Hansen Limited

16 Hanover square

Mayfair

London

W1S 1HT

info@solanghansen.com

للحجز والإستفسار

'. nl2br($error_msg) . "

"; } if ($result != NULL) { echo '

'. $result . "

"; } ?>