- 浏览: 18812 次
- 性别:
- 来自: 武汉
文章分类
最新评论
原创随笔】强大的谷歌开源免费验证码reCAPTCHA
1,首先访问http://code.google.com/intl/zh-CN/apis/recaptcha/intro.html,然后点击左侧相应语言,博主示例用的jsp,所以下载jar包,可直接【点此下载jar包】解压zip中的recaptcha4j-0.0.7.jar至web项目lib下。
2,访问https://www.google.com/recaptcha/admin/create并用google账户登录,在文本框输入自己网站的网址,如global-key.mycompany.com ,点击create key,生成Public Key和Private Key。
3,在jsp中编写示例form
<%@ page import="net.tanesha.recaptcha.ReCaptcha" %> <%@ page import="net.tanesha.recaptcha.ReCaptchaFactory" %> <html> <body> <form action="" method="post"> <% ReCaptcha c = ReCaptchaFactory.newReCaptcha("填入之前生成的public_key", "填入之前生成的private_key", false); out.print(c.createRecaptchaHtml(null, null)); %> <input type="submit" value="submit" /> </form> </body> </html>
4,编写示例服务端接收校验
<%@ page import="net.tanesha.recaptcha.ReCaptchaImpl" %> <%@ page import="net.tanesha.recaptcha.ReCaptchaResponse" %> <html> <body> <% String remoteAddr = request.getRemoteAddr(); ReCaptchaImpl reCaptcha = new ReCaptchaImpl(); reCaptcha.setPrivateKey("填入之前生成的private_key"); String challenge = request.getParameter("recaptcha_challenge_field"); String uresponse = request.getParameter("recaptcha_response_field"); ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse); if (reCaptchaResponse.isValid()) { out.print("Answer was entered correctly!"); } else { out.print("Answer is wrong"); } %> </body> </html>
1,首先访问http://code.google.com/intl/zh-CN/apis/recaptcha/intro.html,然后点击左侧相应语言,博主示例用的jsp,所以下载jar包,可直接【点此下载jar包】解压zip中的recaptcha4j-0.0.7.jar至web项目lib下。
2,访问https://www.google.com/recaptcha/admin/create并用google账户登录,在文本框输入自己网站的网址,如global-key.mycompany.com ,点击create key,生成Public Key和Private Key。
3,在jsp中编写示例form
<%@ page import="net.tanesha.recaptcha.ReCaptcha" %> <%@ page import="net.tanesha.recaptcha.ReCaptchaFactory" %> <html> <body> <form action="" method="post"> <% ReCaptcha c = ReCaptchaFactory.newReCaptcha("填入之前生成的public_key", "填入之前生成的private_key", false); out.print(c.createRecaptchaHtml(null, null)); %> <input type="submit" value="submit" /> </form> </body> </html>
4,编写示例服务端接收校验
<%@ page import="net.tanesha.recaptcha.ReCaptchaImpl" %> <%@ page import="net.tanesha.recaptcha.ReCaptchaResponse" %> <html> <body> <% String remoteAddr = request.getRemoteAddr(); ReCaptchaImpl reCaptcha = new ReCaptchaImpl(); reCaptcha.setPrivateKey("填入之前生成的private_key"); String challenge = request.getParameter("recaptcha_challenge_field"); String uresponse = request.getParameter("recaptcha_response_field"); ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse); if (reCaptchaResponse.isValid()) { out.print("Answer was entered correctly!"); } else { out.print("Answer is wrong"); } %> </body> </html>
发表评论
-
pdf生成
2013-05-20 10:40 894pd4ml技术html导出pdf,支持中文,兼容Linux ... -
读取zip文件
2013-02-27 11:07 601package com.me.admin.test; impo ... -
spring mvc
2013-01-14 17:33 571Spring MVC 框架搭建及详解 您的评价: ... -
实现基于Spring框架应用的权限控制系统
2013-01-02 11:34 631实现基于Spring框架应用 ... -
url重写
2012-11-19 17:26 744>猎头职位: 陕西: 西安:senior java en ... -
发送邮件
2012-11-15 15:36 494package coffeecatwebmail; impo ... -
获得ip
2012-11-13 16:24 412public class IP { /** * * ... -
怎么修改mysql数据库的密码
2012-11-12 10:01 435GRANT ALL PRIVILEGES ON *.* TO ... -
密码加密
2012-11-08 10:55 437public class MD5 { public stat ... -
自己做的上線的網站
2012-10-09 10:12 533http://www.polyvision.com.hk/ ... -
有用文檔
2012-09-13 18:18 505<pre name="code" c ... -
java中的文件上傳
2012-08-06 14:38 617[Java] Spring2文件上传 ... -
關於java學習的友情鏈接
2012-08-06 14:26 370http://www.g4studio.org/forum-5 ... -
object C
2012-07-27 17:37 503http://www.verycd.com/entrie ... -
Struts2基于注解的Action配置
2012-07-18 16:49 600Struts2基于注解的Action配置 ... -
时间转换的单例模式
2012-07-18 10:21 606/* *时间转换 */ package com.loko ... -
s2s2h3搭建
2012-07-11 18:08 593SSH 环境搭建完整教程 一、SSH ... -
ssh搭建
2012-07-11 18:00 754分享 返回分享首页» 分享 ... -
stuts2配置
2012-07-11 17:49 471struts2环境配置 struts2框架 ... -
转码的方案
2012-07-10 17:48 4Eclipse编码格式修改 2010-07-14 2:54 ...
相关推荐
谷歌的验证码生成工具包,下载解压,使用命令mvn install:install-file -Dfile=(你的路径)/kaptcha-2.3.2.jar -DgroupId=com.google.code.kaptcha -DartifactId=kaptcha -Dversion=2.3.2 -Dpackaging=jar...
基于Springboot+VUE 的前后端分离式谷歌验证码生成器后台代码 ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信...
谷歌验证码.net版谷歌验证码.net版谷歌验证码.net版谷歌验证码.net版谷歌验证码.net版
java对接google验证码完整示例,函前端引入google api.js与后端校验g-recaptcha-response是否合法的业务逻辑,可正常运行。
.net仿google验证码,代码不多,绝对好用。
一个实现使用PHP实现谷歌验证码的小功能
谷歌验证码jar包和教程
谷歌验证码使用工具——kaptcha-2.3.2的使用非常简单;
谷歌验证码,后台安全验证、
kaptcha是google开源的一个非常实用的验证码生成工具类,可以利用kaptcha生成各种各样的验证码,但是它没有上传到maven中央仓库。kaptcha的工作原理是调用com.google.code.kaptcha.servlet.KaptchaServlet生成一个...
利用谷歌kaptcha生成谷歌验证码,输入Google Authenticator APP中动态口令,达到二次验证效果
Mfcclub谷歌验证码自动识别输入
google验证码无刷新内有Demo可以直接放入登陆界面或是注册界面
com.google.code.kaptcha:2.3.2 谷歌验证码依赖下载
Google验证码插件jar包,直接解压存入本地仓库即可使用
此压缩包主要是用来实现验证码功能的,包括谷歌验证码kaptcha-2.3.2.jar包和一些配置说明文档
最新Mfcclub谷歌验证码全自动输入购买积分方法
JavaWeb开发可以拿来看看,了解一下谷歌验证码的使用
前提(本例子是以安卓手机为例,苹果手机也可照此正常绑定): 1.手机已安装谷歌身份验证器,如下: 正文: 方法一(扫二维码): ... ...至此,绑定谷歌验证码教程完成,感谢观看! 作者:anle1022