Package Data | |
---|---|
Maintainer Username: | drakulil |
Maintainer Contact: | andisulistyonugroho@gmail.com (andisulistyonugroho) |
Package Create Date: | 2014-07-04 |
Package Last Update: | 2014-07-04 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:18:59 |
Package Statistics | |
---|---|
Total Downloads: | 18 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
author: andisulistyonugroho@gmail.com package: laravel-drakulil-coolcaptcha
#A. What is this?
##Override setting. You can do it by issuing this code on routes.php (see basic usage)
Coolcaptcha::set_config(array('session_var' => 'lontong'));
width
height
minWordLength
session_var
backgroundColor (in RGB array)
colors (font color in RGB array)
public $colors = array(
array(27,78,181), // blue
array(22,163,35), // green
array(214,36,7), // red
);
#B. Basic usage
<?php
/** /app/routes.php **/
Route::get('/captcha', function()
{
//Coolcaptcha::set_config(array('session_var' => 'just-captcha'));
echo Coolcaptcha::CreateImage();
});
Route::post('/confirm_captcha',function()
{
$confirm_captcha = Input::get('confirm_captcha');
$the_captcha_text = \Session::get('drakulil-coolcaptcha');
if ($confirm_captcha == $the_captcha_text) {
echo 'Match';
} else {
echo 'Not match';
}
});
?>
To generate the image, call the captcha through route that has been specified above (/captcha, method GET)
<img src="captcha" id="captcha" name="captcha">
To confirm the captcha, use the secound route (/confirm_captcha, method POST) u can use an ajax call to this route
#The End