PHP Developers Network
http://forums.devnetwork.net/

reCAPTCHA
http://forums.devnetwork.net/viewtopic.php?f=34&t=131318
Page 1 of 1

Author:  TETYYS [ Fri Aug 26, 2011 10:23 am ]
Post subject:  reCAPTCHA

I got downloaded reCAPTCHA class, etc., but it's not working always grants access even i leave blank. There's my code :
Syntax: [ Download ] [ Hide ]
$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
  }

}
 

Author:  Mordred [ Tue Aug 30, 2011 2:59 am ]
Post subject:  Re: reCAPTCHA

Your "if ($_POST["recaptcha_response_field"])" cuts the check and the die(). Reorder.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/