|
<?php
if ($_SERVER['REQUEST_METHOD'] != "POST"){exit;}
if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){print "Please enable referrer logging to use this contact form. Your message was not sent."; exit;}
function new_line_check($a)
{
if(preg_match('`[\r\n]`',$a)){header("location: $_SERVER[HTTP_REFERER]");exit;}
}
new_line_check($_POST['Name']);
$disallowed_name = array(':',';','"','=','(',')','{','}','@');
foreach($disallowed_name as $value)
{
if(stristr($_POST['Name'],$value)){header("location: $_SERVER[HTTP_REFERER]");exit;}
}
new_line_check($_POST['Email']);
$disallowed_email = array(':',';',"'",'"','=','(',')','{','}');
foreach($disallowed_email as $value)
{
if(stristr($_POST['Email'],$value)){header("location: $_SERVER[HTTP_REFERER]");exit;}
}
$message = "";
foreach($_POST as $key => $value){if(!(empty($value))){$set=1;}$message = $message . "$key: $value\n\n";} if($set!==1){header("location: $_SERVER[HTTP_REFERER]");exit;}
$message = $message . "-- \nThank you ";
$message = stripslashes($message);
$subject = "Comments";
$headers = "From: " . $_POST['Email'] . "\n" . "Return-Path: " . $_POST['Email'] . "\n" . "Reply-To: " . $_POST['Email'] . "\n";
mail($my_email,$subject,$message,$headers);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Help Request Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-uk">
</head>
<body bgcolor="#ffffff" text="#000000">
<div>
<center>
<font face="arial" size="2"><b>Thank you <?php print stripslashes($_POST['Name']); ?>!</b>
<br>Your message has been sent</font>
<p><font face="arial" size="2"><a href="<?php print "main.htm"; ?>">Click here to continue</a></font></p>
<p><font face="arial" size="2"></p>
</center>
</div>
</body>
</html>
the form is stardard run of the mill stuff, few boxes and a drop down, when i send it gives the thank you message but never arrives!
Im a little stuck now!! My html and java is ok, my PHP is poor as i found out!! lol
Thanks for your help!
|