sam keen's corner of the web

Very Simple Captcha

Very Simple Captcha or “Poor Man’s Captcha”

This is a very simple way to implement a Captcha concept. It is less effective than say a generated on the fly image (using something like GD), but it is far better than using nothing at all.

Summary of Usage

In the PHP scripts that controls a page that requires a Captcha, simpley call the static function Captcha::generateCaptchaCode().

Then in the template of the page use Captcha::getHTMLCaptcha() to retrieve the HTML markups for the images representing the code.

Then on submision of the form with the captch, check the submitted value against the code in the session ($_SESSION['captcha_code'] by default)

Example Captcha Image

Simple Usage Example



Code for the Static Captcha class

Leave a Reply

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>