记录一下增强PHPCMS V9验证码辨识度的办法:

首先找到这两个文件并在DW中打开它们:

phpcms\libs\classes\checkcode.class.php // PHPCMS验证码
phpsso_server\phpcms\libs\classes\checkcode.class.php // PHPSSO验证码

1、适当加大验证码:

//增加验证码的宽度
public $width=200;
	
//增加验证码的高度
public $height=80;

2、只开启纯数字验证码

//设置随机生成因子
//public $charset = 'abcdefghkmnprstuvwyzABCDEFGHKLMNPRSTUVWYZ23456789';
public $charset = '0123456789';

3.1、取消文字倾斜和抖动

//imagettftext($this->img, $this->font_size, rand(-30,30), $x*$i+rand(0,5), $this->height/1.4, $this->font_color, $this->font, $this->code[$i]);

3.2、减少文字倾斜和抖动

imagettftext($this->img, $this->font_size, rand(-0,0), $x*$i+rand(0,0), $this->height/1.4, $this->font_color, $this->font, $this->code[$i]);

4.取消验证码干扰线条

$this->creat_font();
//$this->creat_line();
$this->output();

好了,这样的有点是方便用户识别增强用户体验,但弊端是没有不容易识别的验证码过滤的严格,大家自行选择是否采用,当然我们也可以举一反三,做出各种个性的验证码样式。

" /> 验证码 · 任刚 · Ren Gang - 我的设计笔记

验证码    82

增强PHPCMS V9验证码辨识度的办法

小贴士      

登 录 注 册