Page 1 of 1

reCAPTCHA

Posted: Fri Aug 26, 2011 10:23 am
by TETYYS
I got downloaded reCAPTCHA class, etc., but it's not working always grants access even i leave blank. There's my code :

Code: Select all

$cookie_expi = Time() + 3600;
if ($_POST["recaptcha_response_field"]) 
{
require_once('captcha/recaptchalib.php');
$publickey = "6Lf4escSAAAAAN9OLgHanRuVMG8xJQUaQ3Cdd6Dt";
$privatekey = "***NOPE***"; 
$resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);
  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
         die("<title>Tetgud loto - Neteisingas kodas</title><br /><h3><center>Neteisingas kodas</center><br /><center><a href='zltglvform.php'>Bandyti dar karta</a></center></h3>");
  } else {
      setcookie("tetgudlotocaptchacount",0,$cookie_expi);
    // Your code here to handle a successful verification
  }

}

Re: reCAPTCHA

Posted: Tue Aug 30, 2011 2:59 am
by Mordred
Your "if ($_POST["recaptcha_response_field"])" cuts the check and the die(). Reorder.