| Status | stub |
|---|---|
| Todo | Write me |
Captchas are used to protect your site by showing something that a computer can't recognize but a human can. They are usually placed on your registration page but they can be placed anywhere you want to make reasonably sure you are dealing with a person and not a bot.
Kohana's Captcha library can currently generates basic, alpha, word, math, riddle captchas. Captcha configuration is defined in groups which allows you to easily switch between different Captcha settings for different forms on your website.
Configuration is done in the application/config/captcha.php file, if it's not there take the one from system/config and copy it to the application folder (see cascading filesystem):
$config['default'] = array ( 'style' => 'basic', 'width' => 150, 'height' => 50, 'complexity' => 4, 'background' => '', 'fontpath' => SYSPATH.'fonts/', 'fonts' => array('DejaVuSerif.ttf'), 'promote' => FALSE, );
Note: all groups inherit and overwrite the default group.
style defines the captcha type, e.g. basic, alpha, word, math, riddle. There are 5 different drivers:
basic - draws a picture with a random text (only distinct alpha numeric characters that can't be mistaken for others)alpha - draws a picture with a random text (only distinct alpha characters)word - ask for a random word loaded from the current language (i18n/xx_XX/captcha.php)math - generates a mathematic challenge such as 2 + 8 = ?riddle - asks for a riddle such as Fire is... (hot or cold) (loaded from i18n/xx_XX/captcha.php)
For basic and alpha styles drawing a picture, height and width define the size of the picture.
It defines the difficulty level of the generated captcha. Usage depends on chosen style:
basic - [1:10] complexity setting is used as character countalpha - [1:10] complexity setting is used as character countword - [2:9] complexity setting is used as word lengthmath - [0;4;8], higher the complexity is, harder is the challenge
background is the path to background image file used for basic and alpha Captcha
fontpath is the font file used for basic and alpha Captcha. fonts is an array of font files. Several fonts means that characters have randomized fonts choosen in the array.
promote is a valid response count threshold to promote user (FALSE to disable)