suggestion:
seems like in the future it'd be a better option to make another file to import the recaptcha public and private keys from also. that way users dont mess up php files.
Bump:
----------------------------------------------------------------------------------------------------------------------------------------------------------------
got it to work after modifying the files joe said in his posts here. all credit goes to him for making this work.
first I made an account for google recaptcha and added my site url to get private and public key here:
Code:
https://www.google.com/recaptcha/admin
second i did the file edits joe posted here. (good idea to back these files up after for next time)
file edits:
http://www.bvlist.com/showpost.php?p=52086&postcount=25
template modes pictured below:
http://www.bvlist.com/showpost.php?p=52086&postcount=27
third in the template editor I modified the main template. sigup, and captcha template (good idea to backup the default template before you modify anything in here)
like so
main
captcha (don't forget to put in your public key here)
sigup
then put your private key in the updated /library/classes/class_captcha.php file
-------------------------
Bump: I have to do some more testing because confirmation working correctly.
- the new member signup to complete but I see this wierd confirmation. must be the captcha template mod i did.
wierd confirmation
Bump: I fixed the weird error. It was a self inflected wound in class_captchA.php I added the ?> like PHP has and for some reason xam leaves out.
-----------------------------------------------------------
I'm having and issue getting class_captcha.php to return true. If I set it manually to true it works. I've tried making a new PHP using CURL instead the fileget method but same result.
TESTING CURL METHOD BUT SAME RESULT
Code:
<?php
class TSUE_captcha
{
public function verifyCaptcha($recaptcha_challenge_field = "", $recaptcha_response_field = "")
{
//
//PUT YOUR PRIVATE KEY HERE//
$secret = "6LcsM2gUAAAAAAjbvuAs-YtADTLyAKkG96AX8nmK";
//
//
//
$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, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, array(
'secret' => $secret,
'response' => $response,
'remoteip' => $remoteip
));
$curlData = curl_exec($curl);
curl_close($curl);
// Parse data
$jsonResponse = json_decode($curlData);
if ($jsonResponse->success === true)
return true;
else
return false;
}
}