This is a demo of it's normal use!
This is a demo with debugging!
And this shows some random imagedimensions & configurations!
Get a FontPackage (ZIP witch 5 TrueTypeFonts) and extract it to the hn_captcha-folder.
You can download the class at phpclasses.org!
UP (to the list)
Main Class: hn_captcha (hn_captcha.class.php)
/** * PHP-Class hn_captcha Version 1.4, released 04-Oct-2007 * * Author: Horst Nogajski, email@example.com * * $Id: shortinfo.php,v 1.2 2009/03/25 11:52:10 horst Exp $ * * Download: http://hn273.users.phpclasses.org/browse/package/1569.html * * License: GNU LGPL (http://www.opensource.org/licenses/lgpl-license.html) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **/ /** * 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 at www.phpclasses.org * 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(). * * The class comes with examplefiles. * If you don't have it: http://hn273.users.phpclasses.org/browse/package/1569.html * * ---------------------------------------------------------------------------- * * HISTORY * * * changes in version 1.1: (2004-April-16) * * - added a new configuration-variable: maxrotation * * - added a new configuration-variable: secretstring * * - modified function get_try(): now ever returns a string of 16 chars *____ * * * changes in version 1.2: (2004-April-19) * * - added a new configuration-variable: secretposition * * - once more modified the function get_try(): generate a string of 32 chars length, * where at secretposition is the number of current-try. * Hopefully this is enough for hackprevention. *____ * * * changes in version 1.3: (2006-April-11) * * - fixed a security-hole, what was discovered by Daniel Jagszent. Many thank's for * testing, fixing and sharing it, Daniel! * He has tested the class in a modified way, like it is described here: * http://www.puremango.co.uk/cm_breaking_captcha_115.php * It was possible to manually do the captcha-test, notice the public and private keys. * In automated way this keys could send as long as the image-file exists! * (with different other datas and independent from the new captcha-string!) *____ * * * changes in version 1.4: (2007-October-04) * * - fixed get_gd_version to check extension_loaded and get the version directly from GD-library. (no more use of php_info()) * ( thanks to Jari Turkia and others ) * * - added display_form_part function. The general idea is to use HN-captcha as a part of an existing form. * A new examplefile comes with the package therefor: hn_captcha.example_formpart.php * ( thanks to Jari Turkia and all people who have posted to the supportforum ) * * - fixed use of Debug. Added param for DebugSwitch to constructor now. * ( reported from and thanks to Mist Hill ) * * - added the ability to automatically scan the TTF_folder for available '.ttf'-files. * To use this, you have to set the var TTF_range to (string)'AUTO', instead of passing and array with filenames. * ( thanks to cYbercOsmOnauT (Tekin) ) * * - added new boolean Configuration-Param: use_only_md5 * If is set to TRUE, we only use chars 0-9 and A-F for Keygeneration, * if is set to FALSE, the default, we use 2-9 (without 8) and A-Z (without B I O). * Small range we get with md5($str), wide range we get with base64_encode(md5($str)) * * - modified the private key generator (function generate_private()) to replace some chars that may confuse the users, especially when using stylized fonts. * ( thanks to Bill Price ) * * - added new string Configuration-Param: form_action_method * Is only needed when working with function "Display_Form_Part". * Value can be 'POST' or 'GET', default is 'POST'. * * - added some Languages: * - Italian, Andrea Nicaretta * - French, Benoit Dausse * - Finnish, Jari Turkia * ( thank you ) * * - packed some TrueTypeFonts for the package: * - get them here: http://nogajski.de/horst/php/captcha/fonts.zip * and unpack them with subfolder to the hn_captcha folder. Then the * examples should run directly! * - they are all from Tom7: http://fonts.tom7.com/ * please read his License http://fonts.tom7.com/legal/ or http://fonts.tom7.com/legal/readme.txt * (the file is included in fonts-dir, too) * ( many thanks Tom! ) * * ... and few other little changes and sanitizing. * * ( ... and many thanks to all the people who have send me mails with nice words or ascii-art =:) ) *____ * **/