diff --git a/contact.php b/contact.php index 963ded2..ded89e1 100644 --- a/contact.php +++ b/contact.php @@ -11,10 +11,9 @@ if(addslashes(strip_tags($_POST['form_address'])) != "" AND addslashes(strip_tags($_POST['form_name'])) != "" AND addslashes(strip_tags($_POST['form_message'])) != "") { $email = addslashes(strip_tags($_POST['form_address'])); + $email = filter_var($email, FILTER_SANITIZE_EMAIL); - $check = '/^[a-zA-Z0-9.\-_]+@[a-zA-Z0-9\-.]+\.[a-zA-Z]{2,4}$/'; - - if(preg_match($check, $email)) + if (filter_var($email, FILTER_VALIDATE_EMAIL)) { if($_SESSION['captcha'] != addslashes(strip_tags($_POST['user_code']))) { @@ -27,7 +26,7 @@ - Submitter's address: ".addslashes(strip_tags($_POST['form_address']))."
+ Submitter's address: ".$email."
Submitter's name: ".addslashes(strip_tags($_POST['form_name']))."
IP: ".addslashes(strip_tags($_POST['ip']))."
Message:
@@ -36,7 +35,7 @@ "; $subject="Message from Twittodon.com ".date('d-m-Y H:i'); $header = "MIME-Version: 1.0r\n"."Content-type: text/html; charset=utf-8\n"; - $header .= "From: ".addslashes(strip_tags($_POST['form_address']))."\n"; + $header .= "From: ".$email."\n"; $address = "contact@twittodon.com"; mail($address, $subject, $message, $header); @@ -330,4 +329,4 @@ - \ No newline at end of file +