Merge pull request #108 from hotwebmatter/patch-2

Disable form mail if spambot fills hidden field
main
Jerome Lachaud 5 years ago committed by GitHub
commit bf671f7038
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,7 +20,7 @@ if ($email_address === FALSE) {
$phone = $_POST['phone'];
$message = $_POST['message'];
if (empty($_POST['_gotcha'])) { // If hidden field was filled out (by spambots) don't send!
// Create the email and send the message
$to = 'yourname@yourdomain.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
$email_subject = "Website Contact Form: $name";
@ -29,4 +29,7 @@ $headers = "From: noreply@yourdomain.com\n"; // This is the email address the ge
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
return true;
}
echo "Gotcha, spambot!";
return false;
?>

Loading…
Cancel
Save