DEDECMS后台登录空白解决办法

77

解决方法:

打开 /userlogin.class.php 文件,在当前文件搜索keepUser(),然后把这个下面的@session_register();给注释掉就行了!

当然要不影响,可以改成

 代码如下
if (!isset($_SESSION[$this->keepUserTypeTag]))

修改完的函数:

 代码如下

function keepUser()
    {
        if($this->userID != '' && $this->userType != '')
        {
            global $admincachefile,$adminstyle;
            if(empty($adminstyle)) $adminstyle = 'dedecms';

   if (!isset($_SESSION[$this->keepUserIDTag]))
   //@session_register($this->keepUserIDTag);   
   $_SESSION[$this->keepUserIDTag] = $this->userID;
   if (!isset($_SESSION[$this->keepUserTypeTag]))
   //@session_register($this->keepUserTypeTag);
   $_SESSION[$this->keepUserTypeTag] = $this->userType;
   if (!isset($_SESSION[$this->keepUserChannelTag]))
   //@session_register($this->keepUserChannelTag);
   $_SESSION[$this->keepUserChannelTag] = $this->userChannel;
   if (!isset($_SESSION[$this->keepUserNameTag]))
   //@session_register($this->keepUserNameTag);
   $_SESSION[$this->keepUserNameTag] = $this->userName;
   if (!isset($_SESSION[$this->keepUserPurviewTag]))
   //@session_register($this->keepUserPurviewTag);
   $_SESSION[$this->keepUserPurviewTag] = $this->userPurview;
   if (!isset($_SESSION[$this->keepAdminStyleTag]))
   //@session_register($this->keepAdminStyleTag);
   $_SESSION[$this->keepAdminStyleTag] = $adminstyle;
            PutCookie('DedeUserID', $this->userID, 3600 * 24, '/');
            PutCookie('DedeLoginTime', time(), 3600 * 24, '/');
           
            $this->ReWriteAdminChannel();
           
            return 1;
}
   else
{
     return -1;
}

我的问题解决了,但有些朋友并不是因为这个问题导致的。

DedeCMS 5.3/5.5/5.6等版本的UTF版本会经常遇到一个问题,就是后台登录会什么都不显示,空白一片


般这个问题都是由于使用了“记事本”而没有使用专业的文本编辑软件来编辑DedeCMS的文件造成的,一般是由于修改了以下几个文件:

include/common.inc.php
data/common.inc.php
dede/config.php

如果你使用了“记事本”之类的软件修改这些文件,修改后都会在文件中加上BOM,造成程序不能正常运行。

可以使用下面的代码来清除文件中的BOM,解决DEDECMS后台列表和登录空白的问题:

Cs_BomKill.php代码:

 代码如下

<?php

//此文件用于快速测试UTF8编码的文件是不是加了BOM,并可自动移除
//By Bob Shen
$basedir="."; //修改此行为需要检测的目录,点表示当前目录
$auto=1; //是否自动移除发现的BOM信息。1为是,0为否。

//以下不用改动

if ($dh = ($basedir)) {
       while (($file = readdir($dh)) !== false) {
       if ($file!='.' && $file!='..' && !is_dir($basedir."/".$file)) echo "filename: $file ".checkBOM("$basedir/$file")." <br>";
       }
       closedir($dh);
}

function checkBOM ($filename) {
       global $auto;
       $contents=file_get_contents($filename);
       $charset[1]=($contents, 0, 1);
       $charset[2]=substr($contents, 1, 1);
       $charset[3]=substr($contents, 2, 1);
       if (ord($charset[1])==239 && ord($charset[2])==187 && ord($charset[3])==191) {
            if ($auto==1) {
                  $rest=substr($contents, 3);
                  rewrite ($filename, $rest);
                  return ("<font color=red>BOM found, automatically removed.</font>");
            } else {
                  return ("<font color=red>BOM found.</font>");
            }
        }
         else return ("BOM Not Found.");
}

function rewrite ($filename, $data) {
        $filenum=($filename,"w");
        flock($filenum,LOCK_EX);
        fwrite($filenum,$data);
        fclose($filenum);
}
//结束
?>

如果上面办法还是无法解决你的问题我们可按下面方法来排查

找到:include/common.inc.php文件,打开,查找程序代码:

 代码如下

  //error_reporting(E_ALL);

  error_reporting(E_ALL || ~E_NOTICE);

替换为:

  error_reporting(E_ALL);

  //error_reporting(E_ALL || ~E_NOTICE);

这一步很重要,因为它会告诉你为什么变成空白的提示信息,这样登录后面就会看到错误提示了。

The End

相关推荐

织梦dedecms生成报错Fatal error: Allowed memory size of in /include
织梦生成静态html页面时报错:Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /wwwroot/include/helpers/string.helper.php on line 121 字面意思理解是内存不足,很多朋友可能认为是内存不足问题,实际上不...
2023-10-13 dedecms安装使用
329

织梦Dedecms限制栏目列表生成的页数
有时候我们的文档特别的多,另外也是为防止网站被采集,全站文章被索引,所以要控制下织梦dedecms列表页面数量。 这样的话我们要具体怎么操作呢? 1、首先建立一个全局变量: 在系统-站点设置中添加一个新的变量,变量名称:cfg_listmaxpage,变量说明:栏目...
2023-05-24 dedecms安装使用
126

dedecms织梦全局变量调用方法总结
dedecms织梦的全局变量可以在/include/common.inc.php文件中看到,此文件内定义了大量的全局变量,详细自己去看看。 如果我们要实用dedeCMS织梦全局变量该如何调用: 第一种单独调用: {wmd:global.变量名 /},注意闭合,否则会以文本形式输出。这种一般适用...
2023-03-01 dedecms安装使用
238

织梦DEDECMS 栏目文章文章命名规则修改
织梦DEDECMS 栏目文章文章命名规则修改, 每次添加栏目的时候 都要改文章命名规则,十分麻烦, 修改下面这个地方就可以一改永亦,织梦模板网为您解答 找到\include\common.inc.php 搜索 $cfg_df_namerule 把: $cfg_df_namerule = {typedir}/{Y}/{M}{D}/{aid...
2021-09-24 dedecms安装使用
165

解决dedecms织梦系统{wmd:arclist keyword='动态获取关键词'}只生效一次
当我们通过{wmd:arclist keyword=关键词}来调用文章列表时,你会发现只在其中一个栏目里生效,在其他栏目,仍然显示上一次的关键词。 原因是由于arclist的缓存导致的。 只需修改/include/taglib/arclist.lib.php文件,大概在384行: $taghash = md5(seriali...
2021-09-24 dedecms安装使用
212

织梦dedecms数据库内容替换安全确认码怎么去掉
我们在使用织梦dedecms数据库内容替换时候,经常遇到 安全码 显示的无法识别或者不清晰,这个安全码的位置是在核心 - 批量维护 - 数据库内容替换,如果识别不了,这个页面还没有改变验证码的地方,只能重新刷新页面,如果我们不想要这个安全码的话,要怎么操...
2021-09-24 dedecms安装使用
109