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的更多相关文章

  1. Config

    Config Config App Auth Cache Database Languages Mail Modules Routing Session Config Settings for the ...

  2. ASP.NET Core 中文文档 第四章 MVC(3.6.1 )Tag Helpers 介绍

    原文:Introduction to Tag Helpers 作者:Rick Anderson 翻译:刘浩杨 校对:高嵩(Jack) 什么是 Tag Helpers? Tag Helpers 提供了什 ...

  3. ASP.NET Core 中文文档 第四章 MVC(3.6.2 )自定义标签辅助类(Tag Helpers)

    原文:Authoring Tag Helpers 作者:Rick Anderson 翻译:张海龙(jiechen) 校对:许登洋(Seay) 示例代码查看与下载 从 Tag Helper 讲起 本篇教 ...

  4. [asp.net core]定义Tag Helpers

    原文地址 https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/authoring Getting started wi ...

  5. [asp.net core] Tag Helpers 简介(转)

    原文地址 https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro What are Tag Helpers? ...

  6. Handlebars块级Helpers

    1.Handlebars简单介绍: Handlebars是JavaScript一个语义模板库,通过对view和data的分离来快速构建Web模板.它采用"Logic-less templat ...

  7. 在 ASP.NET MVC 中使用 HTML Helpers 的那些事

    在 ASP.NET MVC 中使用 HTML Helpers 方法,可以返回得到标准的 HTML 标签,就像 <input>.<button> 或者 <img> 等 ...

  8. 理解ASP.NET MVC中的HTML Helpers

    01 内联Html Helpers @helper listItems(string[] items) { <ol> @foreach (var item in items) { < ...

  9. CKEditor Html Helpers for ASP.NET MVC3 Razor/WebForms Views

    一.原生方法: 在 razor 中 使用Fckeditor 编辑内容,需要引入js <script src="@Url.Content("~/fckeditor/fckedi ...

随机推荐

  1. Tkinter教程之Event篇(3)

    本文转载自:http://blog.csdn.net/jcodeer/article/details/1823550 '''Tkinter教程之Event篇(3)''''''11.两个事件同时绑定到一 ...

  2. Tkinter教程之Event篇(2)

    本文转载自:http://blog.csdn.net/jcodeer/article/details/1823548 '''Tkinter教程之Event篇(2)''''''5.测试离开(Leave) ...

  3. ACM2033

    /**人见人爱A+B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Su ...

  4. java集合框架复习

    数组类Array是java中最基本的一个存储结构,它用于存储 一组连续的对象或一组类型相同的基本类型的数据. Array特点:效率高,但容量固定且无法动态改变, 缺点:无法判断其中存有多少元素,len ...

  5. Another mysql daemon already running with the same unix socket

    在国外网站发现的解决方法. 原因多个Mysql进程使用了同一个socket. 两个方法解决: 第一个是立即关机 使用命令 shutdown -h now 关机,关机后在启动,进程就停止了. 第二个直接 ...

  6. JDBC学习笔记(9)——DBUtils的使用

    使用DBUtils提供的功能需要使用commons-dbutils-1.6.jar这个JAR包,在Apache官网可以下载到 使用DBUtils进行更新操 测试QueryRunner类的update方 ...

  7. Linux下的vi编辑命令中查找·替换详解

    一.查找 查找命令 /pattern<Enter> :向下查找pattern匹配字符串 ?pattern<Enter>:向上查找pattern匹配字符串 使用了查找命令之后,使 ...

  8. HDU 5623 KK's Number (博弈DP)

    KK's Number 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/K Description Our lovely KK h ...

  9. Codeforces 599D Spongebob and Squares(数学)

    D. Spongebob and Squares Spongebob is already tired trying to reason his weird actions and calculati ...

  10. IntelliJ IDEA 开发工具项目maven管理

    今天自己重新部署一下intellij下的项目开发环境,顺便把maven管理项目jar包的方法梳理一下 (1)首先下载apache-maven-3.0.4版本的maven,我自己解压在D:\maven\ ...