search



  

Latest 5

Club Francais Korthals N79 1975
Posted: 2018-01-27 04:36:49
Invisible Google Captcha
Posted: 2017-11-10 12:51:42
Font Awesome
Posted: 2017-10-25 01:25:14
PHP Filemtime() Function - Last Updated
Posted: 2017-10-14 14:43:44

Top 5

Norwegian Kennel Club Database
Posted: 2015-10-22 10:36:06 (1903 Reads)
LOSH (Belgium) Scans Available
Posted: 2017-04-29 19:47:07 (1638 Reads)
ENCI - Italian Studbook
Posted: 2015-10-26 09:54:35 (1581 Reads)
AKC 1895
Posted: 2015-10-22 11:38:43 (1493 Reads)

Join our Newsletter

to get informed about new blog entries!
We care about your privacy - we do not send our Newsletters to all registered users, only if you subscribe HERE!
* indicates required
Choose your Category/Categories

Facebook


Ask for becoming a member of the closed group: Dog Pedigree Databases/Research

Invisible Google Captcha

Captchas are designed to separate between humans and bots. 
Google's recaptcha captcha system is widely used on the Internet. The system is more userfriendly than many other solutions, as you may only have to click the "I'm not a robot" box to pass the captcha and enter the site.
The new invisible captcha from Google is even better. Instead of having to click a box, users may not have to do anything to access to a site that uses the new invisible recaptcha. The algorithm determines if a user is human, if not the system falls back to captcha solving. 
 
To integrate the Google Invisible Captcha on your site you have to do 2 Steps:
1) Register your website for the use of the Google Captcha (https://www.google.com/recaptcha/admin#list)
2) add the relevant code to your php files - In the example below we will show how to bind both the form as well as the captcha to only ONE submit button.
2a) Input file:
 
Define the variable $capPub (your public key)
.....
<form id="contact" action="whatever.php" method="post">
.....
<button class="g-recaptcha" data-sitekey="<?php echo $capPub;?>" data-callback="captchaSubmit" >Submit</button>
</form>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
    <script>
        function captchaSubmit(data) {
            document.getElementById("contact").submit();
        }
</script>
 
2b) Output file:
 
Define the variable $capSec (your secret key)
<?php
// reCaptcha info
        $secret = $capSec;
        $remoteip = $_SERVER["REMOTE_ADDR"];
        $url = "https://www.google.com/recaptcha/api/siteverify";
.....
$response = $_POST["g-recaptcha-response"];
 
        // Curl Request
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, array(
            'secret' => $secret,
            'response' => $response,
            'remoteip' => $remoteip
            ));
        $curlData = curl_exec($curl);
        curl_close($curl);
 
        // Parse data
        $recaptcha = json_decode($curlData, true);
        if ($recaptcha["success"]) {
.....
}
else
            echo "Your Error Message";
 ?>

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.
No Ratings have been Posted.
Render time: 0.10 seconds
282,932 unique visits