A
A
Andrew Dabich2013-12-11 00:38:36
PHP
Andrew Dabich, 2013-12-11 00:38:36

Why does reCAPTCHA not work correctly?

I install reCAPTCHA on the site under Drupal, entered all the codes for the domain that are given on the site for captcha interaction. But here is the problem. He always gives out that the entered code is not correct. With no exceptions.
Created a function to check the correctness of the entered code.

function valid_capcha()
{
   $privatekey = "6LfSl-sSA***ALK3p-*****_Yx4gZ*******v4c";
   $resp = recaptcha_check_answer($privatekey,
                                  $_SERVER["REMOTE_ADDR"],
                                  $_POST["recaptcha_challenge_field"],
                                  $_POST["recaptcha_response_field"]);

   if (!$resp->is_valid) {
      return false;
   } else {
      return true;
   }
}

If the captcha is correct, an email is sent.
$validate = valid_capcha();

   if ($validate)
   {
      drupal_mail_send($message);
   }

The code gave that the whole point was clear. But everything seems to be transmitted correctly. And the verification does not pass truthfully.
Another captcha pops up separately from the form, its two fields are transferred to the form from where it was called and sent by the post.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew Dabich, 2013-12-11
@dabich

The problem seems to be resolved. The crap was in the js script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question