Tuesday, 8 June 2010

Image Captcha updated

I have recently added a feature in the image captcha class, which is simple to be able to generate a random string and pass it on to captcha class. The class will then create the captcha image which could be used for human verification. This feature makes it easier to use the captcha class from external files.

the file could be downloaded from

and the simple to use instructions are as follows:

//create a random string
$md5 = md5(microtime() * mktime());
$captcha_str = substr($md5,0,8);
//then simply include the captcha file
$captcha = new Captcha();
$_get['s'] = $captcha_str;

The above example will print the image on whole page. To add it in a part of you page simple add this bit of the code in a php file:

$captcha = new Captcha();

and supposed you name the file as image_captcha.php

now simply from you html or form do
<img src = "<any base path>/image_captcha.php?s=yourString" />
There was an error in this gadget