How to use an image to prevent comment spam – Captcha

Written by Scott on Thursday, March 8th, 2007

I recently designed and developed a website for AValive/Triangle Visual Interactive and the owner of the site was getting frustrated with all the comment spam he was receiving. The website has several forms and people were either wasting their time, visiting the site and putting in junk, or the site was being hit by a spam bot. Spam bots crawl the internet looking for sign up forms, comment forms, blogs, etc., and put in junk data and submit them. Junk data is usually in the form of some advertisement for Viagra, Real Estate deals and porn.

So I did some research on the net to try and find out how to prevent comment spam. I’ve often signed up for things on the net and been required to type in a text field some numbers or letters that I see in an image.

Luckily, I came across a great site that described how to implement this Captcha image in like 10 minutes. It also shows you how to do an audio clip so that site users could listen to a recording and then they would type in what they hear.

To use this technique, you need at least PHP 4 compiled with GD 1 or 2 (Image Generation) and FreeType text support. It should work fine with Linux, Mac OS X or Windows based systems although you will need to change the default temporary file storage directory specified when using with Windows. PHP session support is also required. The audio CAPTCHA requires the Flite text to speech synthesis engine – more details on set up below.

Some other features of this technique:

  • Multiple random TrueType fonts
  • Character rotation
  • Optional chararacter shadow support
  • Optional site owner display text
  • Random custom background images
  • Font size selection
  • Greyscale or colour lines and characters
  • Character set selection
  • Integration of validation function for checking the user entered code with the generated code

Hope this helps somone else.

Link: Instructions on how to install Captcha image

Comments are closed.