Helpers\RainCaptcha
Helpers\RainCaptcha
This class can validate CAPTCHA images with RainCaptcha.
It can generate an URL to display a CAPTCHA validation image served by the RainCaptcha service.
The class can also send a request to RainCaptcha API to verify if the text that the user entered matches the text in the CAPTCHA image.
RainCaptcha is a CAPTCHA class that does not require any image processing extensions (GD, ImageMagick, etc). CAPTCHA was developed to be readable by humans and resistant to OCR software. It generates black-and-white images with 5 distorted letters on them and noise. Its checking algorithm is case-insensitive.
Create an alias:
use Helpers\RainCaptcha;
To use the class create a new instance, this can then be used to generate a captcha image using ->getImage().
$rainCaptcha = new RainCaptcha();
<img id="captchaImage" src="<?php echo $rainCaptcha->getImage(); ?>" />
<input name="captcha" type="text" />
<button type="button" class='btn btn-danger' onclick="document.getElementById('captchaImage').src =
'<?php echo $rainCaptcha->getImage(); ?>&morerandom=' + Math.floor(Math.random() * 10000);"><span class="icon icon-refresh"></span></button>
To check if a user's input matches the captcha
$rainCaptcha = new RainCaptcha();
if (!$rainCaptcha->checkAnswer($_POST['captcha'])) {
die('You have not passed the CAPTCHA test!');
}
Helpers\RainCaptcha的更多相关文章
- Config
Config Config App Auth Cache Database Languages Mail Modules Routing Session Config Settings for the ...
- ASP.NET Core 中文文档 第四章 MVC(3.6.1 )Tag Helpers 介绍
原文:Introduction to Tag Helpers 作者:Rick Anderson 翻译:刘浩杨 校对:高嵩(Jack) 什么是 Tag Helpers? Tag Helpers 提供了什 ...
- ASP.NET Core 中文文档 第四章 MVC(3.6.2 )自定义标签辅助类(Tag Helpers)
原文:Authoring Tag Helpers 作者:Rick Anderson 翻译:张海龙(jiechen) 校对:许登洋(Seay) 示例代码查看与下载 从 Tag Helper 讲起 本篇教 ...
- [asp.net core]定义Tag Helpers
原文地址 https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/authoring Getting started wi ...
- [asp.net core] Tag Helpers 简介(转)
原文地址 https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro What are Tag Helpers? ...
- Handlebars块级Helpers
1.Handlebars简单介绍: Handlebars是JavaScript一个语义模板库,通过对view和data的分离来快速构建Web模板.它采用"Logic-less templat ...
- 在 ASP.NET MVC 中使用 HTML Helpers 的那些事
在 ASP.NET MVC 中使用 HTML Helpers 方法,可以返回得到标准的 HTML 标签,就像 <input>.<button> 或者 <img> 等 ...
- 理解ASP.NET MVC中的HTML Helpers
01 内联Html Helpers @helper listItems(string[] items) { <ol> @foreach (var item in items) { < ...
- CKEditor Html Helpers for ASP.NET MVC3 Razor/WebForms Views
一.原生方法: 在 razor 中 使用Fckeditor 编辑内容,需要引入js <script src="@Url.Content("~/fckeditor/fckedi ...
随机推荐
- 《Genesis-3D开源游戏引擎-FQA常见问题解答》2014年01月10号版本
1.Genesis-3D开源游戏引擎主要面向哪些用户人群?有限制吗? 1.我们的引擎没有限制,只要您想了解和使用我们的引擎,就可以加入Genesis-3D的大家庭.2.我们的主要用户群是各个相关的企业 ...
- data audit on hadoop fs
最近项目中遇到了存储在HDFS上的数据格式不对,是由于数据中带有\r\n的字符,程序处理的时候没有考虑到这些情况.历史数据大概有一年的时间,需要把错误的数据或者重复的数据给删除了,保留正确的数据,项目 ...
- ERROR (ClientException): Unexpected API Error
- 客户端接口AGENDA
日程 周二上午:完善客户端功能.接口定义. 周二下午:助教审查客户端代码.审查完成之后将发布接口定义. 提示 总之谢谢大家的支持.我们会尽量降低交互难度,让各位亲把精力专注于算法设计上面. 可以使用任 ...
- STC89C52RC片内资源介绍
STC89C52RC片内有:用户应用程序区(AP)8K,地址0000h-1FFFh. 数据flash区(EEPROM)4K,2000h-2FFFh ISP引导区空间1K/2k/4k. RAM 512B ...
- [iOS微博项目 - 1.0] - 搭建基本框架
A.搭建基本环境 github: https://github.com/hellovoidworld/HVWWeibo 项目结构: 1.使用代码构建UI,不使用storyboard ...
- HTTP常见错误 400/401/403/404/500及更多
HTTP 错误 400 400 请求出错 由于语法格式有误,服务器无法理解此请求.不作修改,客户程序就无法重复此请求. HTTP 错误 401 401.1 未授权:登录失败 此错误表明传输给服务器的证 ...
- SPOJ 375 (树链剖分 - 边权剖分 - 修改单边权)
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28982#problem/I 给你一棵有边权的树,有两个操作:一个操作是输出l到 ...
- FORTRAN程序设计权威指南
<FORTRAN程序设计权威指南> 基本信息 作者: 白海波 出版社:机械工业出版社 ISBN:9787111421146 上架时间:2013-7-23 出版日期:2013 年7月 ...
- mac 下对 iterm 终端 设置代理
vi .profile export http_prox="http://xxxx:port" export https_proxy="http://xxxx:port& ...