Skip to content

Instantly share code, notes, and snippets.

@iamrobert
Created July 14, 2020 05:51
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 iamrobert/dc59aa3ff8e99d9357c4d28745878039 to your computer and use it in GitHub Desktop.
Save iamrobert/dc59aa3ff8e99d9357c4d28745878039 to your computer and use it in GitHub Desktop.
rsform honeypot
$spam = false;
if($_POST['form']['HoneyPotFieldName'] != '') {
$spam = true;
}
if (preg_match( "/bcc:|cc:|multipart|\[url|Content-Type:/i", implode($_POST['form']))) {
$spam=true;
}
// Detect more than 3 outgoing links
if (preg_match_all("/<a|https?:/i", implode($_POST['form']), $out) > 3)
{
$spam=true;
}
if ($spam)
{
exit('We are unable to process your request - please contact us in other ways');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment