如果你能帮助我,我真的很感激。
我有一个以此按钮结尾的表单:
<button type="submit" value="Create" name="new">Create</button>
然后PHP使用:
处理它if(isset($_POST['new']) && $_POST['new'] == "Create")
所以我正在尝试添加reCAPTCHA并且我有这段代码:
<?php
require_once('recaptchalib.php'); // reCAPTCHA Library
$pubkey = ""; // Public API Key
$privkey = ""; // Private API Key
if ($_POST['doVerify']) {
$verify = recaptcha_check_answer($privkey, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
if ($verify->is_valid) {
# Enter Success Code
//process form
}
else {
# Enter Failure Code
echo "You did not enter the correct words. Please try again.";
}
}
?>
但我不知道如何链接它们。
感谢您的建议!
答案 0 :(得分:0)
只是做:
<?php
require_once('recaptchalib.php'); // reCAPTCHA Library
$pubkey = ""; // Public API Key
$privkey = ""; // Private API Key
if(isset($_POST['new']) && $_POST['new'] == "Create") {
if ($_POST['doVerify']) {
$verify = recaptcha_check_answer($privkey, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
if ($verify->is_valid) {
# Enter Success Code
//process form
}
else {
# Enter Failure Code
echo "You did not enter the correct words. Please try again.";
}
}
}
?>
如果表单的其余部分没有通过验证,那么验证CAPTCHA没有多大意义,对吗?
答案 1 :(得分:0)
让您的“php代码”的文件名为"capt.php"
将表单的操作更改为"capt.php"
例如:
action =
“capt.php”
享受!