recaptcha not validating on server side

I have used reCaptcha control. The Problem is that the Captcha is not validating itself, i have wrote a validating code i.e.,

[php]require_once(‘recaptchalib.php’);
$privatekey = “my key”;
$resp = recaptcha_check_answer ($privatekey,
$_SERVER[“REMOTE_ADDR”],
$_POST[“recaptcha_challenge_field”],
$_POST[“recaptcha_response_field”]);

if (!$resp->is_valid) {
$errCapt=‘

The CAPTCHA Code wasnot entered correctly.

’; }[/php]
Even if i put the wrong code , it goes on…

Please help

You are missing the last couple lines of your code…

Replace this:
if (!$resp->is_valid) {
$errCapt=‘

The CAPTCHA Code wasnot entered correctly.

’; }

With this:
if (!$resp->is_valid) {
// What happens when CAPTCHA was entered incorrectly (Your code is okay.)
$errCapt=‘

The CAPTCHA Code wasnot entered correctly.

’;
} else {
// Your code here to handle a successful verification (Missing something to do if it is good!)
}
?>
Sponsor our Newsletter | Privacy Policy | Terms of Service