记录一下增强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();
好了,这样的有点是方便用户识别增强用户体验,但弊端是没有不容易识别的验证码过滤的严格,大家自行选择是否采用,当然我们也可以举一反三,做出各种个性的验证码样式。
增强PHPCMS V9验证码辨识度的办法
https://www.rengang.com.cn/phpcms-v9-checkcode-class.html
「真诚赞赏,手留余香」
赞助用于本站维护,手机长按识别二维码。
任刚(rengang.com.cn)整理分享,欣赏作品版权均归原作者所有,仅供学习交流。点击上方图标与好友分享!
发表回复
要发表评论,您必须先登录。