Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (7) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2016-03-27 (7 months ago) | Not enough user ratings | Total: 140 | All time: 8,238 This week: 1,016 |
Version | License | PHP version | Categories | |||
ci-recaptcha 1.0.0 | GNU General Publi... | 5.3 | PHP 5, User Management, Libraries, Va..., S... |
Description | Author | |
This package is a CodeIgniter controller for ReCAPTCHA validation. |
Little package to get [recaptcha][5] working on [codeigniter][1]
Setup and obtain a key pair from [recaptcha admin console][6] for your project domain; both are required. The firs is used on captcha widget rendering, the second when checking response validity.
It's also important to check the URL endpoint to be used for remote validation; the information is available under server side integration step.
Copy config/Recaptcha.php
and libraries/Recaptcha.php
under codeigniter project application folder.
Please note that default shipped configuration is using test keys, so you have to replace them in config/Recaptcha.php
with the ones coming from completion of previous step (and better to disable allowed test keys). The rows to edit are the following:
$config['allowtestkeys'] = TRUE;
$config['profile_sitekey'] = '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI';
$config['profile_secretkey'] = '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe';
According to [documentation][3], config variables can be mapped to customize widget, like theme, size, etc.
A way to install via composer is allowed referencing packagist handle [afelicioni/codeigniter-recaptcha][7] like
{
"require": {
"afelicioni/codeigniter-recaptcha": "dev-master"
}
}
in a custom composer.json and to be triggered by
composer install
At last, controllers/Recaptcha.php
provides a direct usage example.
Functionality is split in two parts, for widget rendering and response verification.
First, be sure to load library
$this->load->library('recaptcha');
In controller, call widget
to obtain outputable code for displaying widget. You can (it's optional!) pass an array as parameter to customize language, theme, size and so on.
$this->recaptcha->widget(array('hl'=>'fr','theme'=>'dark','size'=>'compact'));
To verify response, call verify
and pass a string to perfor check for.
$checkme = $this->recaptcha->verify($this->input->post('g-recaptcha-response'));
if ($check) {
echo 'hey, you look like a human!';
}
Strict check for IP address
by Alessio Felicioni | Github
[1]: http://www.codeigniter.com/ [2]: https://developers.google.com/recaptcha/ [3]: https://developers.google.com/recaptcha/docs/display [4]: https://developers.google.com/recaptcha/docs/verify [5]: https://developers.google.com/recaptcha/intro [6]: https://www.google.com/recaptcha/admin [7]: https://packagist.org/packages/afelicioni/codeigniter-recaptcha
Files |
File | Role | Description | ||
---|---|---|---|---|
config (1 file) | ||||
controllers (1 file) | ||||
libraries (1 file) | ||||
composer.json | Data | Auxiliary data | ||
GPL-v.2.0 | Lic. | License text | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.