PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of Axel Pardemann   AMDev_Captcha   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Readme
Class: AMDev_Captcha
Generate form elements for CAPTCHA validation
Author: By
Last change: Changed MAX_TRIES to reflect the new optuion of infinite attempts
Date: 15 years ago
Size: 4,041 bytes
 

Contents

Class file image Download
This class generates a CAPTCHA (Completely Automated Public Turing to tell Computers from Humans Apart) image to embed in forms and validate them. 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 or not. The class is based in the code of hn_captcha released also in this site by Horst Nogajski with the name hn_captcha. The following enhancements were added: - Display an optional refresh link to generate a new picture with a different key without counting to the user attempts limit verification using AJAX (xajax framework) - Use of prefix for image filenames - Includes the Garbage Collector with option to disable it - Programatic POST redirection to perform the CAPTCHA validation and then redirect the form data to any processing page (not 100% stable) - Messages for different languages are easier to change. It uses language files instead of changing code. - Added a ConfigToString() function to display the current CAPTCHA configuration All the configuration settings are passed to the class in an array when the object instance is initialized. For more details about the options read the readme.txt and the notes.txt To run the example just place some ttf fonts in the captcha/fonts folder and it will work straight ahead. The full configuration options list (this options are passwed in the init array to the contructor): "DEBUG_ENABLED" bool: If true then debugging is enabled. "CAPTCHA_PATH" string: Absolute or relative path to where the images will be saved. (Must be writable and must be in the same published web-tree as the script). "CAPTCHA_PREFIX" string: Prefix to be used for the image filenames. "CAPTCHA_CLASS" string: CSS class name for the displayed HTML tags. "FONT_PATH" string: Absolute or relative path to where the fonts collection is. "FONT_COLLECTION" mixed[array(strings)|string]: The font or array of fonts to be used. AUTO takes all fonts in FONT_PATH. "CHAR_NUMBER" integer: Length of the text string to be generated. "CHAR_MIN_SIZE" integer: Minimum size for a char in the captcha. "CHAR_MAX_SIZE" integer: Maximum size for a char in the captcha. "CHAR_MAX_ROTATION" integer: The maximum degrees a Char should be rotated. Set it to 30 means a random rotation between -30 and 30. "CASE_SENSITIVE" bool: If true the private key is case-sensitive. "MAX_TRIES" integer: Maximum input attempts before considering it an attack. Infinite attempts with MAX_TRIES=0. "SESSION_INFO_LEN" integer: The length of the session info string. "SECRET_POS" integer[1, SESSION_INFO_LEN]: Position in a 32 length string where the session tries are stored (must be less or equal to SESSION_INFO_LEN). "SECRET_PHRASE" string: A "secret" string to generate the md5 hash key. "NOISE_ENABLED" bool: If enabled captcha will be rendered with background noise, if not then just with a grid. "NOISE_FACTOR" integer: Background noise factor. "LANGUAGE_FILE" string: Absolute or relative path to the language file to be used for the text outputs. "FORM_METHOD" string[POST|GET]: The method the form is using to send the data. "REFRESH_ENABLED" bool: If enabled the user can requesta a captcha regeneration without modifying the try count. "ONLY_MD5" bool: If true it uses only the md5 function for encoding. "WEB_SAFE_COLORS" bool: If true the image will only use web safe colors. "JPEG_QUALITY" integer: Quality to be used for JPEG output image. "XAJAX_INC_FILES" mixed[array(strings)|string]: The relative paths to the include files for xajax. "XAJAX_JS_PATH" string: Absolute or relative path to the Xajax JS core file. "XAJAX_DEBUG_ENABLED" bool: If true then Xajax debug is enabled. "GC_ENABLED" bool: If true the GC is enabled. "GC_IDLE_COUNT" integer: Number of captchas to generate before calling GC. "GC_CAPTCHA_PERIOD" integer: Captcha alive period in seconds before GC collects it.