开源 PHP 验证码 Securimage 带语音识别
[08-23 22:08:40] 来源:http://www.duoxue8.com PHP教程 阅读:352次
开源 PHP 验证码 Securimage 带语音识别,标签:PHP技巧,php培训,php学习,php安装,http://www.duoxue8.com
官方网站:http://www.phpcaptcha.org/
下载地址:http://www.phpcaptcha.org/download/
原文地址:http://www.21andy.com/blog/20100417/1886.html
Securimage 使用方法:
验证码图片:
<img id="captcha" src="/securimage/securimage_show.php" alt="CAPTCHA Image" />
验证码文本框:
<input type="text" name="captcha_code" size="10" maxlength="6" />
看不清验证码:
<a href="#" rel="nofollow" target="_blank">Reload Image</a>
原文地址:http://www.21andy.com/blog/20100417/1886.html
后端PHP验证:
<?php
session_start();
include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
// the code was incorrect
// handle the error accordingly with your other error checking
// or you can do something really basic like this
die('The code you entered was incorrect. Go back and try again.');
}
session_start();
include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
// the code was incorrect
// handle the error accordingly with your other error checking
// or you can do something really basic like this
die('The code you entered was incorrect. Go back and try again.');
}
Securimage 类属性:
$img->image_width = 275;
$securimage->image_height = 90;
$securimage->perturbation = 0.9; // 1.0 = high distortion, higher numbers = more distortion
$securimage->image_bg_color = new Securimage_Color("#0099CC");
$securimage->text_color = new Securimage_Color("#EAEAEA");
$securimage->text_transparency_percentage = 65; // 100 = completely transparent
$securimage->num_lines = 8;
$securimage->line_color = new Securimage_Color("#0000CC");
$securimage->signature_color = new Securimage_Color(rand(0, 64), rand(64, 128), rand(128, 255));
$securimage
$securimage->image_height = 90;
$securimage->perturbation = 0.9; // 1.0 = high distortion, higher numbers = more distortion
$securimage->image_bg_color = new Securimage_Color("#0099CC");
$securimage->text_color = new Securimage_Color("#EAEAEA");
$securimage->text_transparency_percentage = 65; // 100 = completely transparent
$securimage->num_lines = 8;
$securimage->line_color = new Securimage_Color("#0000CC");
$securimage->signature_color = new Securimage_Color(rand(0, 64), rand(64, 128), rand(128, 255));
$securimage