valleyco/securimage

PHP CAPTCHA 库

3.7.1 2015-11-29 05:46 UTC

This package is auto-updated.

Last update: 2024-09-21 20:18:03 UTC


README

Securimage - 一个用于创建具有多种选项的 CAPTCHA 图像和音频的 PHP 类。

版本

3.6.2

作者

Drew Phillips drew@drew-phillips.com

下载

最新版本始终可在 phpcaptcha.org 找到

文档

类的在线文档、方法和变量可以在 http://www.phpcaptcha.org/Securimage_Docs/ 找到

要求

  • PHP 5.2 或更高版本
  • GD 2.0
  • FreeType(必需,用于 TTF 字体)
  • PDO(如果使用 Sqlite、MySQL 或 PostgreSQL)

概述

在您的 HTML 表单中

<form method="post" action="">
.. form elements

<div>
    <?php
        require_once 'securimage.php';
        echo Securimage::getCaptchaHtml();
    ?>
</div>
</form>

在您的 PHP 表单处理器中

require_once 'securimage.php';

// Code Validation

$image = new Securimage();
if ($image->check($_POST['captcha_code']) == true) {
  echo "Correct!";
} else {
  echo "Sorry, wrong code.";
}

描述

什么是 Securimage

Securimage 是一个 PHP 类,用于生成和验证 CAPTCHA 图像。

该类使用现有的 PHP 会话或在找不到会话时创建自己的会话来存储 CAPTCHA 代码。此外,可以使用数据库代替会话存储。

类中的变量用于控制图像的样式和显示。该类使用 TTF 字体和效果来增强图像的安全性。

它还创建可听代码,为视觉障碍用户播放。

升级通知

3.6.2 及以上版本

如果您正在升级到 3.6.2 或更高版本,并且使用数据库存储,则 3.6.2 中已更改表结构,添加了 audio_data 列以在数据库中存储音频文件以支持 HTTP 范围请求。删除您的表并让 Securimage 重新创建它们,或查看 securimage.php 中的 createDatabaseTables() 函数以获取新结构,具体取决于您使用的数据库后端,并根据需要进行修改表。如果使用 SQLite,只需用本发行版中的文件覆盖您现有的 securimage.sq3 文件即可。

如果您不使用数据库表进行存储,请忽略此通知。

版权

脚本版权(c)2015 Drew Phillips 所有权利保留。

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

许可协议

WavFile.php

The WavFile.php class used in Securimage by Drew Phillips and Paul Voegler
is used under the BSD License.  See WavFile.php for details.
Many thanks to Paul Voegler (http://www.voegler.eu/) for contributing to
Securimage.

脚本

Securimage 的 Flash 代码

Flash 代码由 Age Bosma & Mario Romero 创建 (animario@hotmail.com)。非常感谢将此发布到项目中!

HKCaptcha

Securimage 的一部分包含来自 Han-Kwang Nienhuys 的 PHP captcha 的代码

Han-Kwang Nienhuys' PHP captcha
Copyright June 2007

This copyright message and attribution must be preserved upon
modification. Redistribution under other licenses is expressly allowed.
Other licenses include GPL 2 or higher, BSD, and non-free licenses.
The original, unrestricted version can be obtained from
http://www.lagom.nl/linux/hkcaptcha/

AHGBold.ttf

AHGBold.ttf (AlteHaasGroteskBold.ttf) font was created by Yann Le Coroller
and is distributed as freeware.

Alte Haas Grotesk is a typeface that look like an helvetica printed in an
old Muller-Brockmann Book.

These fonts are freeware and can be distributed as long as they are
together with this text file. 

I would appreciate very much to see what you have done with it anyway.

yann le coroller 
www.yannlecoroller.com
yann@lecoroller.com

PopForge Flash 库

securimage_play.swf 的一部分使用 PopForge Flash 库来播放音频

/**
 * Copyright(C) 2007 Andre Michelle and Joa Ebert
 *
 * PopForge is an ActionScript3 code sandbox developed by Andre Michelle
 * and Joa Ebert
 * http://sandbox.popforge.de
 *
 * PopforgeAS3Audio is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * PopforgeAS3Audio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://gnu.ac.cn/licenses/>
 */

图形

一些图形来自 WorLord 的 Humility Icon Pack

 License: GNU/GPL (http://findicons.com/pack/1723/humility)
 http://findicons.com/icon/192558/gnome_volume_control
 http://findicons.com/icon/192562/gtk_refresh

背景噪声声音文件来自 SoundJay.com

http://www.soundjay.com/tos.html

 All sound effects on this website are created by us and protected under
 the copyright laws, international treaty provisions and other applicable
 laws. By downloading sounds, music or any material from this site implies
 that you have read and accepted these terms and conditions:

 Sound Effects
 You are allowed to use the sounds free of charge and royalty free in your
 projects (such as films, videos, games, presentations, animations, stage
 plays, radio plays, audio books, apps) be it for commercial or
 non-commercial purposes.

 But you are NOT allowed to
 - post the sounds (as sound effects or ringtones) on any website for
   others to download, copy or use
 - use them as a raw material to create sound effects or ringtones that
   you will sell, distribute or offer for downloading
 - sell, re-sell, license or re-license the sounds (as individual sound
   effects or as a sound effects library) to anyone else
 - claim the sounds as yours
 - link directly to individual sound files
 - distribute the sounds in apps or computer programs that are clearly
   sound related in nature (such as sound machine, sound effect
   generator, ringtone maker, funny sounds app, sound therapy app, etc.)
   or in apps or computer programs that use the sounds as the program's
   sound resource library for other people's use (such as animation
   creator, digital book creator, song maker software, etc.). If you are
   developing such computer programs, contact us for licensing options.

 If you use the sound effects, please consider giving us a credit and
 linking back to us but it's not required.