include("includes/variable_defns.inc.php"); ?> $sentmail = FALSE; function valid_email($email) { $res = preg_match('/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$/mi', $_POST['email']); return $res == 1; } function remove_email_headers($string, $full, $emails) { // remove \r and \n if($full) { $string = ereg_replace("\r", '', $string); $string = ereg_replace("\n", '', $string); // remove hex $string = preg_replace('/%[0-9A-Fa-f]{2}/', ' ', $string); // remove anything: $string = preg_replace('/[a-zA-Z\-]+:/', ' ', $string); } // remove BCC:, BCc:, etc. $string = str_replace(array('BCC:', 'BCc:', 'BcC:', 'Bcc:', 'bCC:', 'bCc:', 'bcC:', 'bcc:'), '', $string); // remove CC:, Cc:, etc. $string = str_replace(array('CC:', 'Cc:', 'cC:', 'cc:'), '', $string); // remove TO:, To:, etc. $string = str_replace(array('TO:', 'To:', 'tO:', 'to:'), '', $string); // remove email addresses (with optional space in front and comma in back) if($emails) $string = preg_replace('/ ?[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4},?/i', '', $string); return $string; } if($_POST['name']) { if(valid_email($_POST['email'])) { $name = $_POST['name']; $email = remove_email_headers($_POST['email'], true, false); $subj = remove_email_headers($_POST['subject'], true, true); $msg = remove_email_headers($_POST['msg'], false, false); // service@ticketsintime.com $sentmail = mail('service@ticketsintime.com', $subj, $msg, "From: $email\r\n" ."Reply-To: $email\r\n" ."X-Mailer: PHP/" . phpversion()); } else { $error = 'The entered email is invalid. Please enter a valid email to continue.'; } } ?>
Please use the form below to contact us. We will get back to you shortly.
if($error) print "$error
"; ?> } else { ?>Your message has been sent. We will get back to you shortly. Thanks!
} ?>