bgli100 / securimage
PHP CAPTCHA 库
Requires
- php: >=5.4
- ext-gd: *
Suggests
- ext-pdo: For database storage support
- ext-pdo_mysql: For MySQL database support
- ext-pdo_sqlite: For SQLite3 database support
README
Securimage - 一个用于创建带有多种选项的 CAPTCHA 图像和音频的 PHP 类。
版本
3.6.8
项目状态
在 GitHub 上查看 项目状态 问题。
下载
在 https://github.com/dapphp/securimage 下载并浏览代码。Beta 代码可在 https://github.com/dapphp/securimage/tree/nextgen 找到。
其他信息可在 phpcaptcha.org 找到。
文档
该类的在线文档、方法和变量可在 http://www.phpcaptcha.org/Securimage_Docs/ 找到。
要求
- PHP 5.4 或更高版本
- 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 是一个用于生成和验证 CAPTCHA 图像的 PHP 类。
该类使用现有的 PHP 会话或如果没有找到则创建自己的会话来存储 CAPTCHA 代码。此外,可以使用数据库而不是会话存储。
类中的变量用于控制图像的样式和显示。该类使用 TTF 字体和效果来增强图像的安全性。
它还创建可听代码,为视障用户播放。
升级通知
3.6.3 和以下版本:Securimage 3.6.4 修复了 example_form.ajax.php 中的 XSS 漏洞。建议升级到最新版本或从您的网站上的 securimage 目录中删除 example_form.ajax.php。
3.6.2 和以上版本
如果您正在升级到 3.6.2 或更高版本 并且 使用数据库存储,则 3.6.2 中已更改表结构,添加了 audio_data 列以在数据库中存储音频文件以支持 HTTP 范围请求。删除您的表并让 Securimage 重新创建它们,或查看 securimage.php 中的 createDatabaseTables() 函数以获取新结构,根据您使用的数据库后端进行修改。如果使用 SQLite,只需用本发行版中的文件覆盖您现有的 securimage.sq3 文件。
如果您不使用数据库表进行存储,请忽略此通知。
版权
脚本版权 (c) 2018 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 代码
由 Age Bosma & Mario Romero 创建的 Flash 代码 (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 Library
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.