想试试织梦的产品,下载了DedeCMS V5.7版本,在本地部署后,正确登录后台的情况下页面没有任何输出和显示(错误登录或密码错误时才有显示),也没有报错。进到脚本调试,发现问题出在登录页login.php中以下部分。login.php[php]
view plaincopy
- ...
- $cuserLogin = new userLogin($admindir);
- if(!empty($userid) && !empty($pwd))
- {
- $res = $cuserLogin->checkUser($userid,$pwd);
- //success
- if($res==1)
- {
- $cuserLogin->keepUser();//此处以下无输出
- if(!empty($gotopage))
- {
- ShowMsg('成功登录,正在转向管理管理主页!',$gotopage);
- exit();
- }
- else
- {
- ShowMsg('成功登录,正在转向管理管理主页!',"index.php");
- exit();
- }
- echo "ok";
- }
- ...
到封装userLogin类所在的脚本userlogin.class.php中查看(路径./include/),所用的keepUser()方法代码如下:userlogin.class.php[php]
view plaincopy
- ...
- function keepUser()
- {
- if($this->userID != '' && $this->userType != '')
- {
- global $admincachefile,$adminstyle;
- if(empty($adminstyle)) $adminstyle = 'dedecms';
-
- @session_register($this->keepUserIDTag);
- $_SESSION[$this->keepUserIDTag] = $this->userID;
-
- @session_register($this->keepUserTypeTag);
- $_SESSION[$this->keepUserTypeTag] = $this->userType;
-
- @session_register($this->keepUserChannelTag);
- $_SESSION[$this->keepUserChannelTag] = $this->userChannel;
-
- @session_register($this->keepUserNameTag);
- $_SESSION[$this->keepUserNameTag] = $this->userName;
-
- @session_register($this->keepUserPurviewTag);
- $_SESSION[$this->keepUserPurviewTag] = $this->userPurview;
-
- @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;
- }
- }
把@去掉,session_register()报出错误:
Call to undefined function session_register()
证实了问题来源于此。查手册的描述如下:
"版本:(PHP 4, PHP 5 "本函数已自 PHP 5.3.0 起废弃并将自 PHP 5.4.0 起移除。"查看手册session_register()在PHP5.4后来的版本中已经多余,可以省去而直接用$_SESSION['abc'] ="" ;
查看Stack Overflow关于此方法的问题。
解决方法:去掉或注释掉所有的session_register(),改用直接存$_SESSION数组。keepUser()部分[php]
view plaincopy
- ...
- //session_register($this->keepUserIDTag);
- $_SESSION[$this->keepUserIDTag] = $this->userID;
-
- //session_register($this->keepUserTypeTag);
- $_SESSION[$this->keepUserTypeTag] = $this->userType;
-
- //session_register($this->keepUserChannelTag);
- $_SESSION[$this->keepUserChannelTag] = $this->userChannel;
-
- //session_register($this->keepUserNameTag);
- $_SESSION[$this->keepUserNameTag] = $this->userName;
-
- //session_register($this->keepUserPurviewTag);
- $_SESSION[$this->keepUserPurviewTag] = $this->userPurview;
-
- //session_register($this->keepAdminStyleTag);
- $_SESSION[$this->keepAdminStyleTag] = $adminstyle;
- ...
修改后就正常显示了。我是从织梦主页上下载的"最新"版本,很奇怪难道没有人遇到同样的问题吗。这种问题既然这里能出现,别的部分就无法保证不会有更多这样的隐患存在了。
以上就介绍了DedeCMS后台,页面无显示 ,后台页面空白,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
作者最新文章
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31