在表单中添加CAPTCHA

时间:2013-09-20 08:45:35

标签: php jquery html forms captcha

我现在正在使用dform plugin创建表单。创建普通字段工作正常。是否有任何包含CAPTCHA的dform插件?创建dforms只需要json文件和脚本文件。我们怎样才能添加CAPTCHA?我使用PHP作为服务器端脚本语言。

1 个答案:

答案 0 :(得分:1)

Recaptcha是一个可以与任何形式一起使用的插件

可在此处找到http://www.google.com/recaptcha

以下是有关如何设置http://code.google.com/p/recaptcha/wiki/HowToSetUpRecaptcha

的示例代码
<script type="text/javascript"
   src="https://www.google.com/recaptcha/api/challenge?k=YOUR_PUBLIC_KEY"
 </script>
 <noscript>
   <iframe src="https://www.google.com/recaptcha/api/noscript?k=YOUR_PUBLIC_KEY"
       height="300" width="500" frameborder="0"></iframe><br>
 </noscript>


 require_once('recaptchalib.php');
  $publickey = "YOUR_PUBLIC_KEY"; // You got this from the signup page.
  echo recaptcha_get_html($publickey);
With the code, your form might look something like this:

<!-- your HTML content -->
 <form method="post" action="verify.php">
   <?php
     require_once('recaptchalib.php');
     $publickey = "YOUR_PUBLIC_KEY"; // you got this from the signup page
     echo recaptcha_get_html($publickey);
   ?>
   <input type="submit" />
 </form><br>
<!-- more of your HTML content -->