dev-master
9999999-dev https://github.com/andisulistyonugroho/laravel-coolcaptchamaking a google php-cool-captcha to be usable in laravel
MIT
The Requires
- php >=5.3.0
- illuminate/support 4.1.*
making a google php-cool-captcha to be usable in laravel
You can do it by issuing this code on routes.php (see basic usage), (*1)
Coolcaptcha::set_config(array('session_var' => 'lontong'));
colors (font color in RGB array), (*2)
public $colors = array( array(27,78,181), // blue array(22,163,35), // green array(214,36,7), // red );
<?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), (*3)
<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, (*4)
making a google php-cool-captcha to be usable in laravel
MIT