Changeset 633
- Timestamp:
- Jan 5, 2014, 11:32:57 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r632 r633 1 1 <?php 2 2 3 $Revision = 63 2; // Subversion revision4 $DatabaseRevision = 63 2; // SQL structure revision5 $ReleaseTime = mktime(0, 0, 0, 2, 2, 2014);3 $Revision = 633; // Subversion revision 4 $DatabaseRevision = 633; // SQL structure revision 5 $ReleaseTime = 0;//mktime(0, 0, 0, 2, 5, 2014); -
trunk/Common/Setup/Updates.php
r632 r633 557 557 } 558 558 559 function UpdateTo633($Manager) 560 { 561 $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLoggedHash` VARCHAR( 40 ) NOT NULL ;'); 562 } 563 559 564 class Updates 560 565 { … … 592 597 620 => array('Revision' => 627, 'Function' => 'UpdateTo627'), 593 598 627 => array('Revision' => 632, 'Function' => 'UpdateTo632'), 599 632 => array('Revision' => 633, 'Function' => 'UpdateTo633'), 594 600 )); 595 601 } -
trunk/Modules/User/User.php
r619 r633 81 81 'ScriptName' => $_SERVER['PHP_SELF'])); 82 82 83 // Logged permanently? 84 if(array_key_exists('LoginHash', $_COOKIE)) 85 { 86 $DbResult = $this->Database->query('SELECT * FROM `UserOnline` WHERE `User`='.$_COOKIE['LoginUserId']. 87 ' AND `StayLogged`=1 AND SessionId!="'.$SID.'"'); 88 if($DbResult->num_rows > 0) 89 { 90 $DbRow = $DbResult->fetch_assoc(); 91 if(sha1($_COOKIE['LoginUserId'].$DbRow['StayLoggedHash']) == $_COOKIE['LoginHash']) 92 { 93 $this->Database->query('DELETE FROM `UserOnline` WHERE `SessionId`="'.$SID.'"'); 94 $this->Database->query('UPDATE `UserOnline` SET `SessionId`="'.$SID.'" WHERE `Id`='.$DbRow['Id']); 95 } 96 } 97 } 98 83 99 // Check login 84 100 $Query = $this->Database->select('UserOnline', '*', '`SessionId`="'.$SID.'"'); … … 195 211 else 196 212 { 197 $this->Database->update('User', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()', 'LastIpAddress' => GetRemoteAddress())); 198 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $Row['Id'], 'StayLogged' => $StayLogged)); 213 $this->Database->update('User', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()', 214 'LastIpAddress' => GetRemoteAddress())); 215 $Hash = new PasswordHash(); 216 $StayLoggedSalt = $Hash->GetSalt(); 217 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array( 218 'User' => $Row['Id'], 'StayLogged' => $StayLogged, 'StayLoggedHash' => $StayLoggedSalt)); 219 if($StayLogged) 220 { 221 setcookie('LoginUserId', $Row['Id'], time()+365*24*60*60); 222 setcookie('LoginHash', sha1($Row['Id'].$StayLoggedSalt), time()+365*24*60*60); 223 } else { 224 setcookie('LoginUserId', '', time() - 3600); 225 setcookie('LoginHash', '', time() - 3600); 226 } 199 227 200 228 $Result = USER_LOGGED_IN;
Note:
See TracChangeset
for help on using the changeset viewer.