如何放置reCAPTCHA

时间:2014-02-25 05:53:33

标签: php recaptcha

这将是我的注册表。如果我要在其中添加reCAPTCHA表单,该怎么办?

<form method="post" action="doregister.php" id="register">

注册

<div>
  <label for="username">Username</label><br/>
  <input type="text" id="username" name="username" required="required" placeholder="Username"align="right" width="48" height="48"/>
</div> <br/>

<div>
      <label for="password">Password</label><br/>
  <input type="password"  id="password" name="password" required="required" placeholder="Password"/>
</div> <br/>    

<br/>

<br/>
<input type="submit" id ="btnSubmit" value="Register"/> 

2 个答案:

答案 0 :(得分:0)

developers.google.com有一个非常好的文档,说明如何使用recaptcha与php:

https://developers.google.com/recaptcha/docs/php

答案 1 :(得分:0)

可能的解决方案是使用任何可用的php库。这是一个友好的API,名为 Securimage 有一个PHP脚本可供使用,很少有类可用于生成验证码图像并验证它们。用于验证输入的示例代码

include_once 'securimage.php';
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
  echo "The security code entered was incorrect.<br /><br />";
  echo "Please go <a href='javascript:history.go(-1)'>back</a> and try again.";
  exit;
}

以下是quick start