Hi all,
If still interested in implementing of new Google reCaptcha just follow the steps below (tested on eForm 1.4.6):
1./ Get needed keys -
https://www.google.com/recaptcha/intro/index.html. Click on "GET reCAPTCHA" button (top right).
2./ Add before </head> foll:
<script src='https://www.google.com/recaptcha/api.js'></script>
3./ Add in your form chunk (between <form></form>)
<div class="g-recaptcha" data-sitekey="YOUR_SITE_KEY"></div>
4./ Edit file eform.inc.php (it's in: assets/snippets/eForm/):
- Find "# check vericode", it's around line 185
- replace all in:
- with:
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
$secretKey = "YOUR_SECRET_KEY";
$ip = $_SERVER['REMOTE_ADDR'];
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
$responseKeys = json_decode($response,true);
if(intval($responseKeys["success"]) !== 1) {
$vMsg[count($vMsg)]=$_lang['ef_failed_vericode'];
$rClass['vericode']=$invalidClass; //added in 1.4.4
} ;
-finally it should look like:
# check vericode
if($vericode) {
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
$secretKey = "YOUR_SECRET_KEY";
$ip = $_SERVER['REMOTE_ADDR'];
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
$responseKeys = json_decode($response,true);
if(intval($responseKeys["success"]) !== 1) {
$vMsg[count($vMsg)]=$_lang['ef_failed_vericode'];
$rClass['vericode']=$invalidClass; //added in 1.4.4
} ;}
Don't miss to replace "YOUR_SITE_KEY" and "YOUR_SECRET_KEY" above with your real keys from Google.
That's all.