Skip to content

Instantly share code, notes, and snippets.

@btr2
Created July 11, 2017 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btr2/e255ab06b5380767746e0860084fa8b5 to your computer and use it in GitHub Desktop.
Save btr2/e255ab06b5380767746e0860084fa8b5 to your computer and use it in GitHub Desktop.
Example of a honeypot in a PHP contact form
<?php
// if the honeypot field is empty
if(isset($_POST['honeypot']) && $_POST['honeypot'] == ''){
// Then continue with formatting your email
..........
}
// otherwise, let the spammer think that they got their message through
echo "Message sent";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment