Forms 使reCAPTCHA在同一页面上工作(index.php)
大家好,我有一个表单,我想添加reCAPTCHA到它。 这是我的表格Forms 使reCAPTCHA在同一页面上工作(index.php),forms,recaptcha,Forms,Recaptcha,大家好,我有一个表单,我想添加reCAPTCHA到它。 这是我的表格 <form action="index.php" method="POST"> <div class="header"></div> <div class="headerimg"> <a href="http://sonymobile.comule.com/"><img border="0" src="logo.png" alt=
<form action="index.php" method="POST">
<div class="header"></div>
<div class="headerimg">
<a href="http://sonymobile.comule.com/"><img border="0" src="logo.png" alt="AUD Confession" width="auto" height="auto"></a>
<div class="headertxt">Confession</div>
</div>
<table font-family="inherit">
<tr><td class="comm" colspan="2">Comment: </td></tr>
<tr><td colspan="5"><textarea name="comment" rows="5" cols="50" id="comments" class="common" autofocus></textarea></td></tr>
<tr><td><?php
require_once('recaptchalib.php');
$publickey = "6Lc1RewSAAAAAO2Emd1_ICM5qUssQdfqF0vRiCE9"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?></tr></td>
<tr><td colspan="2"><input type="submit" name="submit" class="myButton" value="SUBMIT"></td></tr>
</table>
</form>
我想让reCAPTCHA在同一页上检查I:eaction=“index.php”
。
请帮忙。
或者提出类似的建议。我自己想出了解决办法。 我所要做的就是添加一些代码来代替
//您的代码在此处理成功的验证
将用户数据插入数据库的php代码
<?php
require_once('recaptchalib.php');
$privatekey = "6Lc1RewSAAAAAPBsu1AnNhJpIbS64XR0fLqEioVb";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
// Your code here to handle a successful verification
}
?>