Hello everybody,
I have a contact form that I've been using on my site. More and more often I receive spam email from it and I'd like some advise on making it spam proof.
All the spam emails contain hyperlinks so I thought a first step might be to have the form object to any field containing 'href'.
The PHP code of the form looks like this:
Thanks for any help,PHP Code:<?
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
if ($_POST["name"] and $_POST["email2"] and $_POST["message"]){
$extra = "?sent=contact";
$name = $_POST['name'];
$email = $_POST['email2'];
$message = $_POST['message'];
$mailing = $_POST['mailing'];
$to = "me@mysite.com";
$subject = "MySite // Contact Form";
$body = "\r\nHello,\r\n\r\nHere is a message from the contact form: \r\n\r\n";
$body .= "Message: - \r\n".$message."\r\n\r\n";
$body .= "Name: ".$name."\r\n\r\n";
$body .= "Email: ".$email."\r\n";
if ($mailing =="Join Mailing List") {
$body .= "Please add this email to the list: \r\n";
}
$body .= "\r\nMessage ends dude!\r\n\r\nPeace out!\r\nDOG.DC5B Mailer";
$from = "From: MySite Mailer <mailer@mysite.com>";
mail($to, $subject, $body, $from, "-fmailer@dmysite.com");
}
else {
$extra = "?sent=no-contact";
}
header("Location: http://$host$uri/$extra");
exit;
?>
Monkeyzbox



Reply With Quote



Bookmarks