[英]ReCaptcha form integrade not working
正在尝试为我的表单创建一个ReCaptcha。
我已经阅读了文档,但是如何将ReCaptcha分级到表单。.我使用了私钥,但是不起作用...
http://www.the-big-bbq.co.uk/invitation.php#prettyPhoto
这是网站
它目前显示,但如果我不输入任何内容,表格仍会提交。
码:
<?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);
?>
我有同样的问题。 因此,我在页面上添加了Java Function validateForm()。 因此,在所有必填字段都没有正确输入之前,现在它不会进入recapcha步骤。
我在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>
我有它到我的网站。 但是服务器验证:“验证没有插件的用户答案”。 不工作。 我尝试添加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);
?>
提示会很棒:)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.