Homegrown Drupal 5 Webform SPAM Filtering

One of my clients started getting massive amounts of SPAM through his web form created contact form. Since this contact form is displayed as a block on ever page, I didn't want to put in an obtrusive captcha. I did try the hidden captcha module, but found that it is already automated against. I decided to hit it straight on and wrote a snippet of code to not submit, but error instead, when the body contains the http prefix.

Here you go:

<?php
if ( stripos($form_values['submitted_tree']['notes_or_comments'], "http") ) {
form_set_error('notes_or_comments', 'Please do not include links to websites in your submissions.');
}
?>

Change the two occurrences of notes_or_comments with the name of the text area you are dealing with. Then stick this code into the Additional Validation under advanced settings.

I know this is in no way a complete solution, but it does save an old client from dealing with two much SPAM and keeps me from doing anymore development in Drupal 5.

Peace out MFers!

Comments

Post new comment

  • Allowed HTML tags: <em> <strong>
  • Lines and paragraphs break automatically.

More information about formatting options

Image CAPTCHA
Enter the characters shown in the image.