lefuturiste / recaptcha_poo
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/lefuturiste/recaptcha_poo
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
- Download this class.
##Usage
A - Server Instalation
- Require this class.
- Initialise class
<?php $captcha = new recaptcha('YOUR PUBLIC KEY GOOGLE API', 'YOUR SECRET KEY GOOGLE API'); ?>
- Verify if empty
$_POST['g-recaptcha-response']
key
<?php if (empty($_POST['g-recaptcha-response'])){ //error } else{ //continue script } ?>
- Verify api response
<?php if ($captcha->isSuccess($_POST['g-recaptcha-response']) == false) { //error } else { //successs } ?>
B - Client Instalation
- 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>
- Get html div :
$dataTheme = 'light'; //$dataTheme = 'dark'; <?= $captcha->getHtml($dataTheme) ?>
Light or Dark display posibility.