简体   繁体   English

ReCaptcha表格集成无法正常工作

[英]ReCaptcha form integrade not working

am trying to create a ReCaptcha for my form. 正在尝试为我的表单创建一个ReCaptcha。

i have gone through the documentation, but how do I inter-grade the ReCaptcha to the form.. I used the private key but that don't work... 我已经阅读了文档,但是如何将ReCaptcha分级到表单。.我使用了私钥,但是不起作用...

http://www.the-big-bbq.co.uk/invitation.php#prettyPhoto http://www.the-big-bbq.co.uk/invitation.php#prettyPhoto

this is the site 这是网站

its showing at the moment, but if i dont enter anything the form still submits. 它目前显示,但如果我不输入任何内容,表格仍会提交。

code: 码:

 <?php
require_once('recaptchalib.php');

// Get a key from https://www.google.com/recaptcha/admin/create
$publickey = "i have added the key here";
$privatekey = "i have added the key here";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;

# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

if ($resp->is_valid) {
        echo "You got it!";
} else {
        # set the error code so that we can display it
        $error = $resp->error;
}
}
 echo recaptcha_get_html($publickey, $error);
?>

I had the same problem. 我有同样的问题。 So I added the Java Function validateForm() on my page. 因此,我在页面上添加了Java Function validateForm()。 So now it won't go to the recapcha step, before all the necessary fields have there correct input. 因此,在所有必填字段都没有正确输入之前,现在它不会进入recapcha步骤。

I used this code in my html form page, to show the recaptcha field: 我在html表单页面中使用了以下代码,以显示recaptcha字段:

<!-- Google recaptcha -->
    <tr>

    <td colspan="5">
    <script type="text/javascript"
   src="http://www.google.com/recaptcha/api/challenge?k=0000000000000000000000...">
</script>
<noscript>
   <iframe src="http://www.google.com/recaptcha/api/noscript?k=0000000000000000000000..."
       height="65" width="109" frameborder="0"></iframe><br>
   <textarea name="recaptcha_challenge_field" rows="2" cols="2">
   </textarea>
   <input type="hidden" name="recaptcha_response_field"
       value="manual_challenge">
</noscript>
    </td>
    <tr>

I have it to my site. 我有它到我的网站。 But the server validation: "Verifying the User's Answer Without Plugins". 但是服务器验证:“验证没有插件的用户答案”。 Wont work. 不工作。 I tried adding the verify.php action (and added the necessary .php files to my root.) But nothing. 我尝试添加verify.php操作(并将必需的.php文件添加到我的根目录。)但是什么也没有。

    <form name="reserveringen" method="post" onsubmit="return validateForm();" action="verify.php">
<?php
require_once('recaptchalib.php');
          $publickey = "0000000000000000000000..."; 
          echo recaptcha_get_html($publickey);
?>

Tips would be great :). 提示会很棒:)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM