function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("Invalid Input!");
}
}
$subject=$_POST['subject'];
checkOK($subject);
$email=$_POST['email'];
checkOK($email);
$message=$_POST['message'];
checkOK($message);
$to="candy@decospirit.com";
if(mail($to,$subject,$message,"From: $email\n")) {
echo "Email Sent. Thanks for contacting us.";
} else {
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>