duandanbeng1829 2015-09-25 02:09
浏览 7

reCaptcha结果不会广播到$ _POST

I have a form, and a table inside of it. I wanted to add reCaptcha, but the form-check is not receiving the $_POST value for the reCaptcha. Here is my form:

<form name="reg" action="code_exec.php" onsubmit="return validateForm()" method="post">

    <td colspan="2">
        <div align="center">
<h1>Register</h1>
        </div></td>
  </tr>

 <tr>

    <td colspan="2"><center><p style="font-family: Arial; font-size: 18px; color: red;">*<span style="color: red; font-family: Arial; font-size: 14px;">Required</span></p></center></td>
 </tr>
 <tr>
    <td><div align="right">Name:<span class="red">*</span></div></td>
    <td><input type="text" name="name" /></td>
  </tr>
 <tr>
    <td><div align="right">Username:<span class="red">*</span></div></td>
    <td><input type="text" name="username" /></td>
  </tr>
  <tr>
    <td><div align="right">E-mail:<span class="red">*</span></div></td>
    <td><input type="text" name="email" /></td>
  </tr>
 <tr>
    <td><div align="right">Password:<span class="red">*</span></div></td>
    <td><input type="password" name="password" /></td>
  </tr>
  <tr>
    <td><div align="right">Confirm Password:<span class="red">*</span></div></td>
    <td><input type="password" name="passwordconf" /></td>
  </tr>
  <tr>
    <td></td>
    <td><div class="g-recaptcha" data-sitekey="6LfDzgITAAAAABkYv1oZe4X7Sy3OqYmk4hQQBMHz"></div></td>
  </tr>
  <tr>
    <td><div align="right"></div></td>
    <td><input name="submit" type="submit" value="Submit" /></td>
  </tr>
  <tr>
    <td></td>
    <td><br><a href="../login">Log In</a>
  </tr>
  <tr>
    <td><div align="right"></div></td>
    <td><input type="text" name="captchaid" style="visibility: hidden;" value="<?php echo $captchaid?>" /></td>
  </tr>
</table>
</table>
</form>   

and here is my code_exec.php:

$captcha=$_POST['g-recaptcha-response'];
var_dump($_POST);
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LfDzgITAAAAAD-l4TY_v6Tnqtb8Y0mtEB-HjApC&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
if($response.success==false) {
  //do stuff
} 
else {
  //process form
}

The problem is, after var_dump($_POST), the g-recaptcha-response doesn't show up. Any solutions?

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?