Home > CMS Tutorial > DEDECMS > body text

What should I do if the dedecms background login verification code is not displayed normally?

王林
Release: 2021-03-08 10:02:54
forward
2546 people have browsed it

What should I do if the dedecms background login verification code is not displayed normally?

前言:

在登录dedecms后台时,经常遇到如下三种问题:

1、后台验证码不显示

What should I do if the dedecms background login verification code is not displayed normally?

2、后台验证码不正常显示

What should I do if the dedecms background login verification code is not displayed normally?

3、后台验证码不正常显示

What should I do if the dedecms background login verification code is not displayed normally?

解决方法:

1、取消后台验证码功能

因为没有验证码 不能进后台 所以修改php文件源代码:

方法一:

打开dede/login.php 找到如下代码

if(($validate=='' || $validate != $svali) && preg_match("/6/",$safe_gdopen)){
        ResetVdValue();
        ShowMsg('验证码不正确!','login.php',0,1000);
        exit;
}
Copy after login

第一行替换为 if(false){

好 问题解决 不输验证码后台直接进去

(学习视频分享:php视频教程

方法二:

打开data/safe/inc.safe.config.php

把代码$safe_gdopen = '1,2,3,4,5,6,7'; 中的6,删除即可

Dede后台验证码不显示情况一分析:

验证码需要GD库 请检查你的环境是否开启GD库

Dede后台验证码不显示情况二分析:

验证码只显示背景 不显示字母

打开验证码生成文件 Include/vdimgck.php

找到

for($i=0;$i<$rndcodelen;$i++)
    {
        $bc = mt_rand(0, 1);
        $rndstring[$i] = strtoupper($rndstring[$i]);
        $c_fontColor = $fontColor[mt_rand(0,4)];
        $y_pos = $i==0 ? 4 : $i*($font_size+2);
        $c = mt_rand(0, 15);
        @imagettftext($im, $font_size, $c, $y_pos, 19, $c_fontColor, $font_file, $rndstring[$i]);
        $lastc = $rndstring[$i];
}
Copy after login

Imagettftext()函数没有成功的执行导致了验证码只显示背景,不显示字母

具体原因为 字体文件路径不对.解决方法

1、确认include/data/fonts/ 里面存在字体文件 默认为ggbi.ttf

2、在for($i=0;$i<$rndcodelen;$i++) 上一行 加上如下代码:

$font_file= str_replace("\\","/",$font_file);
Copy after login

即把字体文件路径中反斜杠替换成斜杠 因为我们知道反斜杠有转译字符的功能,

$font_file 路经大体为 盘符:\appserv\www 系统错误的把反斜杠 当作转义用了 导致$font_file也就不是一个路径了 所以Imagettftext()函数总是返回错误

加上$font_file= str_replace("\\","/",$font_file);即可解决

Dede后台验证码不显示情况三分析:

Include/data/words/words.txt 文件不存在  

解决方案:

(1)拷贝一个进去

(2)找到代码    'word_type'  => (int)$safe_codetype,   // 1:数字  2:英文   3:单词

(3)换成'word_type'  =>1  (或2) 既验证码为数字或英文

Dede后台验证码不显示 全部情况解决

如果原来可以显示后来取消验证码后再设置就无法显示,可以通过覆盖data与include目录试试。

相关推荐:织梦cms

The above is the detailed content of What should I do if the dedecms background login verification code is not displayed normally?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!