This class generates a picture to use in forms that perform CAPTCHA test (Completely Automated Public Turing to tell Computers from Humans Apart). After the test form is submitted a key entered by the user in a text field is compared by the class to determine whether it matches the text in the picture.
The class is a fork of the original released also in this site by Julien Pachet with the name ocr_captcha.
The following enhancements were added:
- Support to make it work with GD library before version 2
- Hacking prevention
- Optional use of Web safe colors
- Limit the number of users attempts
- Display an optional refresh link to generate a new picture with a different key without counting to the user attempts limit verification
- Support the use of multiple random TrueType fonts
- Control the output image by only three parameters: number of text characters and minimum and maximum size preserving the size proportion
- Preserve all request parameters passed to the page via the GET method, so the CAPTCHA test can be added to existing scripts with minimal changes
- Added a debug option for testing the current configuration
All the configuration settings are passed to the class in an array when the object instance is initialized.
The class only needs two function calls to be used: display_form() and validate_submit().
hn_captcha_X1: add a garbage collector (for 'lost' images) to main class.
Since 24 December 2007, there are different classfiles for PHP 4 and PHP 5, ( merry x-mass <<<-| )