DEDECMS后台登录空白解决办法

解决方法:

打开 /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);

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