Fewer Trolls with CAPTCHA

Fed up with 'visitors' to your guestbook posting "Great Job! Try [this drug] for [this body part] enhancement"? Then you need something to bot-proof your forms. And one simple solution is a captcha.

Stop and ReadThe CAPTCHA script requires that your server version of php has been compiled to include the GD2 library (otherwise the images cannot be created!). Any respectable web hosting services will have GD2 pre-installed.

Example of captcha in formWhat is a captcha? Better known as a 'security image' applied in forms of all types to prevent 'bots from sending the form. For those of you interested, Captcha is an acronym for Completely Automated Public Turing Test to Tell Computers and Humans Apart. You can learn more about captchas at captcha.net opens in new window, or one look at the image to the right will tell you what this is about.

Slightly Different

While other php_noob freebies are 'script systems', our captcha download is really just a very simple form example, together with the php script you need to generate a random security image for use with the form. Also included is a configuration file, plus a base background image and .ttf font to give you all you need for a complete, working, example of a form secured by an image. No javascript and no 'hidden fields' in the form. All done with sessions and server-side scripting, you could copy/paste security into your own forms with just a few lines of code.

A single configuration file allows you to adjust various parameters used by the image creation script. There is no need to edit the php script.

Script Features

  • use your own background image (the captcha is randomly selected)
  • easily change font family, font size, font color, font rotation, and font weight
  • script documented in case you really want to change it
  • Works with register_globals off

Download 65kbView DocumentationSee Demonstration

 print page

© Copyright DigitalMidget  - all rights reserved

Welcome - to the bottom of the page. Normally there's nothing of any interest below the content, but on this site there's a "reward" for those of you who read this far.

This site uses valid xHTML and valid CSS. Shazam!! Not only is it valid, but it also meets a reasonable accessibility standard. And you can verify any of those claims by clicking the icons on the right.