Changeset 493 for trunk/Common/User.php
- Timestamp:
- Mar 1, 2013, 9:20:14 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/User.php
r439 r493 51 51 var $User = array(); 52 52 var $DefaultRole = 2; 53 var $AnonymousUserId = 98;54 53 var $OnlineStateTimeout = 600; // in seconds 55 54 var $PermissionCache = array(); … … 74 73 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('ActivityTime' => 'NOW()')); 75 74 } else $this->Database->insert('UserOnline', array('SessionId' => $SID, 76 'User' => $this->AnonymousUserId, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()',75 'User' => null, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 77 76 'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()), 78 77 'ScriptName' => $_SERVER['PHP_SELF'])); 79 //echo($this->Database->LastQuery);80 78 81 79 // Check login 82 80 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 83 81 $Row = $Query->fetch_assoc(); 84 if($Row['User'] != $this->AnonymousUserId)82 if($Row['User'] != '') 85 83 { 86 84 $Query = $this->Database->query('SELECT User.*, UserCustomerRel.Customer AS Member FROM User LEFT JOIN UserCustomerRel ON UserCustomerRel.User=User.Id WHERE User.Id='.$Row['User']); … … 89 87 } else 90 88 { 91 $Query = $this->Database->select('User', '*', 'Id ='.$this->AnonymousUserId);92 $this->User = $Query->fetch_assoc();89 $Query = $this->Database->select('User', '*', 'Id IS NULL'); 90 $this->User = array('Id' => null, 'Member' => null); 93 91 $Result = USER_NOT_LOGGED; 94 92 } … … 99 97 { 100 98 $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']); 101 if($DbRow['User'] != $this->AnonymousUserId) $this->System->Modules['Log']->NewRecord('User', 'Logout');99 if($DbRow['User'] != null) $this->System->Modules['Log']->NewRecord('User', 'Logout'); 102 100 } 103 101 //$this->LoadPermission($this->User['Role']); … … 198 196 // načtení stavu stromu 199 197 $Result = USER_LOGGED_IN; 198 $this->Check(); 200 199 $this->System->Modules['Log']->NewRecord('User', 'Login', 'Login='.$Login.',Host='.gethostbyaddr(GetRemoteAddress())); 201 200 } 202 201 } else $Result = USER_NOT_REGISTRED; 203 $this->Check();204 202 return($Result); 205 203 } … … 208 206 { 209 207 $SID = session_id(); 210 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $this->AnonymousUserId));208 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => null)); 211 209 $this->System->Modules['Log']->NewRecord('User', 'Logout', $this->User['Login']); 212 210 $this->Check();
Note:
See TracChangeset
for help on using the changeset viewer.