I want to try zhimeng's product and download dedecms v5.7. After local deployment, when you log on to the background correctly, the page does not display any output or display (displayed only when the logon or password is incorrect), and no error is reported. Go to script debugging and find that the problem lies in the following part of the login. php logon page.
Login. php
... $ Cuserlogin = new userlogin ($ admindir); If (! Empty ($ userid )&&! Empty ($ PWD) {$ res = $ cuserlogin-> checkuser ($ userid, $ PWD); // success if ($ res = 1) {$ cuserlogin-> keepuser (); // No output if (! Empty ($ gotopage) {showmsg ('successfully logged on, is switching to the Management Homepage! ', $ Gotopage); exit ();} else {showmsg (' successfully logged on, switching to the Management Homepage! ', "Index. php"); exit ();} echo "OK ";}...
To the script userlogin. Class. php that encapsulates the userlogin class (path./include/), the keepuser () method code used is as follows:
Userlogin. Class. php
...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;}}
If @ is removed, session_register () reports an error:
Call to undefined function session_register ()
Confirmed the problem. The manual is described as follows:
"Version: (PHP 4, PHP 5 <5.4.0 )"
"This function has been removed from PhP 5.3.0 and has been removed from PhP 5.4.0. "
View Manual
Session_register () is redundant in later versions of php5.4. Instead, you can directly use $ _ session ['abc'] = "";
View the problem about this method in stack overflow.
Solution: Remove or comment out all session_register () and save the $ _ Session array directly.
Keepuser ()
...//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;...
After modification, it will be displayed normally.
I downloaded the "latest" version from the zhimeng homepage. Is it strange that no one has encountered the same problem. Since this problem can occur, other parts cannot guarantee that there will be no more such hidden risks.
This article is also published in my independent blog. mc-zone.me, click to visit this article