Capcha - adampatterson/Dingo-Framework GitHub Wiki

###Overview The capcha library allows you to easily add image based security capchas to your application. To load the capcha library manually you may do this:

load::library('capcha');

NOTE: Because the capcha library uses sessions to store data, you must load the session library before the capcha library is loaded.

###Set Creates a random capcha code and stores it in a session for later use:

capcha::set('register',5);

This will create a capcha code with the name register that is 5 characters long using the default session settings.

###Delete Deletes a previously set capcha:

capcha::delete('register');

###Check Used to check if a string matches the value of a capcha:

$code = input::post('capcha');

if(capcha::check('register',$code))
{
	echo 'It Matches!';
}
else
{
	echo 'Incorrect!';
}

###Generate Generates and displays a capcha:

capcha::font_file('extra/monofont.ttf');
capcha::generate('register',120,40);

The above will display a 120 wide by 40 tall capcha that was set with the name register. It will use the font file extra/monofont.ttf to create the text for the capcha.

###Font Size Sets the font size in pixels for capcha text:

capcha::font_size(18);

###Font Color Sets the font color for capcha text:

capcha::font_color(25,75,100);

###Background Color Sets the background color for capcha:

capcha::background_color(100,100,100);

###Noise Color Sets the noise color for capcha:

capcha::noise_color(25,200,25);