Im having a issue with my recaptcha. The problem is that it always returns false meaning it says the captcha failed. even when the right word is typed in.
Everything is up to date, using the latest library and triple checked the code and public/private key.
Issue I believe lies here….
require_once('recaptchalib.php');
$privatekey = "************************************";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
$error_string .= '<center>The reCAPTCHA wasnt entered correctly. Go back and try it again.</center><br />';
}
I followed this example so I can’t see what is going wrong. Been at it for days!
https://developers.google.com/recaptcha/docs/php
CLient Code:
require_once('recaptchalib.php');
$publickey = "**********************"; // you got this from the signup page
echo recaptcha_get_html($publickey);
carried out a var dump on the $resp variable and got this
object(ReCaptchaResponse)#2 (2) { ["is_valid"]=> bool(false) ["error"]=> string(21) "incorrect-captcha-sol" }
also did a var_dump recaptcha response field and got:
NULL
var dump post…
array(7) { ["user"]=> string(0) "" ["pass1"]=> string(0) "" ["pass2"]=> string(0) "" ["email"]=> string(0) "" ["email2"]=> string(0) "" ["gender"]=> string(4) "Male" ["register"]=> string(8) "register" }
var dump request…
array(10) { ["user"]=> string(0) "" ["pass1"]=> string(0) "" ["pass2"]=> string(0) "" ["email"]=> string(0) "" ["email2"]=> string(0) "" ["gender"]=> string(4) "Male" ["register"]=> string(8) "register" ["PHPSESSID"]=> string(26) "4e79u2fdgrrufvb79einufcmq6" ["cprelogin"]=> string(2) "no" ["cpsession"]=> string(65) ":fX5Z1aWfbsgjGfgb3b3J7koo3Y58y5ntgM6k8GTdrQ4YAcqaywAKnD7PRiayfXv3" }
Thanks for your support guys. I found the issue so decided to post if anyone comes across this problem in the future.
My form was inside my table, like
Apparently the form should be first then table!