lefuturiste/recaptcha_poo

This package is abandoned and no longer maintained. The author suggests using the google/recaptcha package instead.
There is no license information available for the latest version (v1.0) of this package.

v1.0 2017-01-01 18:41 UTC

This package is auto-updated.

Last update: 2022-02-01 13:04:11 UTC


README

Use this class for have use Google recaptcha api. Use this class for your MVC architecture.

##Instalation

  1. Download this class.

##Usage

A - Server Instalation

  1. Require this class.
  2. Initialise class
  <?php
  $captcha = new recaptcha('YOUR PUBLIC KEY GOOGLE API', 'YOUR SECRET KEY GOOGLE API');
  ?>
  1. Verify if empty $_POST['g-recaptcha-response'] key
  <?php
  if (empty($_POST['g-recaptcha-response'])){
    //error
  }
  else{
    //continue script
  }
  ?>
  1. Verify api response
  <?php
  if ($captcha->isSuccess($_POST['g-recaptcha-response']) == false) {
	  //error
  } else { 
    //successs
  }
  ?>

B - Client Instalation

  1. Include script's file :
  <script type="text/javascript" src="https://cdn.stail.eu/jquery/jquery.min.js"></script>
  <script src='https://www.google.com/recaptcha/api.js'></script>
  1. Get html div :
  $dataTheme = 'light';
  //$dataTheme = 'dark';
  <?= $captcha->getHtml($dataTheme) ?>

Light or Dark display posibility.