Changeset 725
- Timestamp:
- Jan 7, 2014, 8:45:46 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/Translation.php
r626 r725 59 59 function ShowRSS() 60 60 { 61 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100'); 61 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` '. 62 'JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100'); 62 63 while($DbRow = $DbResult->fetch_assoc()) 63 64 { -
trunk/Modules/User/User.php
r714 r725 120 120 $User = $DbResult->fetch_assoc(); 121 121 $this->Id = $User['ID']; 122 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $User['ID'], 'StayLogged' => $StayLogged)); 122 123 // Prepare cookies for permanent login 124 $StayLoggedSalt = $this->GetPasswordSalt(); 125 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array( 126 'User' => $User['ID'], 'StayLogged' => $StayLogged, 'StayLoggedHash' => $StayLoggedSalt)); 127 if($StayLogged) 128 { 129 setcookie('LoginUserId', $User['ID'], time()+365*24*60*60); 130 setcookie('LoginHash', sha1($User['ID'].$StayLoggedSalt), time()+365*24*60*60); 131 } else { 132 setcookie('LoginUserId', '', time() - 3600); 133 setcookie('LoginHash', '', time() - 3600); 134 } 135 123 136 $this->Database->query('UPDATE `UserTrace` SET '. 124 137 '`LastLogin` = NOW(), '. … … 216 229 'ScriptName' => $_SERVER['PHP_SELF'])); 217 230 218 // Check login 231 // Logged permanently? 232 if(array_key_exists('LoginHash', $_COOKIE)) 233 { 234 $DbResult = $this->Database->query('SELECT * FROM `UserOnline` WHERE `User`='.$_COOKIE['LoginUserId']. 235 ' AND `StayLogged`=1 AND SessionId!="'.$SID.'"'); 236 if($DbResult->num_rows > 0) 237 { 238 $DbRow = $DbResult->fetch_assoc(); 239 if(sha1($_COOKIE['LoginUserId'].$DbRow['StayLoggedHash']) == $_COOKIE['LoginHash']) 240 { 241 $this->Database->query('DELETE FROM `UserOnline` WHERE `SessionId`="'.$SID.'"'); 242 $this->Database->query('UPDATE `UserOnline` SET `SessionId`="'.$SID.'" WHERE `Id`='.$DbRow['Id']); 243 } 244 } 245 } 246 247 // Check login 219 248 $Query = $this->Database->select('UserOnline', '*', '`SessionId`="'.$SID.'"'); 220 249 $Row = $Query->fetch_assoc(); -
trunk/admin/UpdateTrace.php
r716 r725 2716 2716 } 2717 2717 2718 function UpdateTo725($Manager) 2719 { 2720 $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLoggedHash` VARCHAR( 40 ) NOT NULL ;'); 2721 } 2722 2718 2723 2719 2724 $Updates = array( … … 2738 2743 695 => array('Revision' => 712 , 'Function' => 'UpdateTo712'), 2739 2744 712 => array('Revision' => 716 , 'Function' => 'UpdateTo716'), 2745 716 => array('Revision' => 725 , 'Function' => 'UpdateTo725'), 2740 2746 ); -
trunk/includes/Version.php
r724 r725 6 6 // and system will need database update. 7 7 8 $Revision = 72 4; // Subversion revision9 $DatabaseRevision = 7 16; // Database structure revision8 $Revision = 725; // Subversion revision 9 $DatabaseRevision = 725; // Database structure revision 10 10 $ReleaseTime = '2014-01-07';
Note:
See TracChangeset
for help on using the changeset viewer.