2017 © Pedro Peláez
 

captcha coolcaptcha

making a google php-cool-captcha to be usable in laravel

image

drakulil/coolcaptcha

making a google php-cool-captcha to be usable in laravel

  • Friday, July 4, 2014
  • by drakulil
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

A. What is this?

  • This package is based on the beautifull php-cool-captcha
  • Resources has been included internally, it did not need external resource like google etc
  • Session to save the captcha text is drakulil-coolcaptcha, this can be override by changing the setting.

Override setting.

You can do it by issuing this code on routes.php (see basic usage), (*1)

    Coolcaptcha::set_config(array('session_var' => 'lontong'));

Available parameters

  • width
  • height
  • minWordLength
  • session_var
  • backgroundColor (in RGB array)
  • 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
    );

B. Basic usage

Routes

<?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';
        }
    });
?>

Image tag

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)

The End

The Versions

04/07 2014

dev-master

9999999-dev https://github.com/andisulistyonugroho/laravel-coolcaptcha

making a google php-cool-captcha to be usable in laravel

  Sources   Download

MIT

The Requires