Google advertisement a new service to avoid the spam and the attacks to your website.
calls it "NO CAPTCHA for reCAPTCHA«. It is designed for protect your website ofhe spam and the abuses.
in this tutorial go to show you how to integrate in your website; for purposes demo I did a simple script and you can improve it
1. Register your website and you will get the key Secret:
https://www.google.com/recaptcha/intro/index.html (Login to your Google account fill out and submit the form)
Once registered your website, Google will provide you next two informations.
–Site key
–Secret key
2. Integrate it to the form of your web page
To integrate it into your website needs put the following code andno the tags HTML of your form <HEAD>.
<script src=’https://www.google.com/recaptcha/api.js’></script>
and to show the reCAPTCHA widget in your form You need to put the following code just before the "submit" button of your form
<div classes="g-recaptcha" data-sitekey="== Your site Key =="></div>
3. Example of how to put in a comment form
<head>
<title>Google replay demo – Codeforgeek</title>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<bodysuit>
<h1>Google reCAPTHA Demo</h1>
<shape id="comment_form" action="form.php" method="post">
<input type="e-mail" place holder="Type your email" size="40"><br><br>
<textarea yam="comment" rows=«8» cols="39"></textarea><br><br>
<input type=submit yam=submit value="Post comment"><br><br>
<div classes="g-recaptcha" data-sitekey="=== Your site key ==="></div>
</shape>
</bodysuit>
</html>
if(isset($_POST['e-mail'])){
$email=$_POST['e-mail'];
}if(isset($_POST['comment'])){
$email=$_POST['comment'];
}if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
threw out '<h2>Please check the captcha form.</h2>';
exit;
}
$response=file_get_contents(“https://www.google.com/recaptcha/api/siteverify?secret=YOUR SECRET KEY&response=”.$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
if($response.success==false)
{
threw out '<h2>You are spammer! Get the @$%K out</h2>';
}else
{
threw out '<h2>Thanks for posting comments.</h2>';
}
?>
I find it easier and more practical