Captcha in 5 lines of PHP :)

Have a go at the demo below!


Please complete the Captcha:
CAPTCHA Image

DISCUSS this at: http://nodstrum.com/2007/09/23/captcha/

View Formatted Source

How to get this working on your site:
Once you have added the code to your PHP pages, you will need to edit captcha.class.php file.

var $imageDirectory = '/path/to/your/captcha/image/directory';
var $imageURL = 'http://yourdomain.com/captchaImages';
var $captchaLabel = 'Please complete the Captcha:';
var $captchaBoxStyle = 'border: 1px solid #ccc; padding: 3px; margin: 3px; width: 210px; font-family: verdana; font-size: 11px;';
Explaination of these variables
$imageDirectory: This is the path to the directory that the images will be creates, this needs writable permissions: chmod 777.
$imageURL: This is the URL to the images directory so we can output them to the users.
$captchaLabel: This is what is displayed above the Captcha telling the user what this is for.
$captchaBoxStyle: This is the style of the captcha box.

Now for the download link: Download it here