Changeset 49 for trunk/www/user.php
- Timestamp:
- Jun 20, 2009, 4:22:51 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/user.php
r46 r49 45 45 $SID = session_id(); 46 46 47 // Lookup user record 48 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 49 if($Query->num_rows == 0) 50 $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => $this->AnonymousUserId, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()), 'ScriptName' => $_SERVER['PHP_SELF'])); 51 //echo($this->Database->LastQuery); 52 47 53 // Check login 48 54 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); … … 70 76 // Lookup user record 71 77 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 72 if($Query->num_rows > 0) 73 { 74 // Refresh time of last access 75 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('ActivityTime' => 'NOW()')); 76 } else $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => $this->AnonymousUserId, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()), 'ScriptName' => $_SERVER['PHP_SELF'])); 77 //echo($this->Database->LastQuery); 78 79 // Check login 80 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 81 $Row = $Query->fetch_assoc(); 82 if($Row['User'] != $this->AnonymousUserId) 83 { 84 $Query = $this->Database->select('User', '*', 'Id='.$Row['User']); 85 $this->User = $Query->fetch_assoc(); 86 $Result = USER_LOGGED; 87 } else 88 { 89 $Query = $this->Database->select('User', '*', 'Id='.$this->AnonymousUserId); 90 $this->User = $Query->fetch_assoc(); 91 $Result = USER_NOT_LOGGED; 92 } 78 if($Query->num_rows == 0) 79 $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => $this->AnonymousUserId, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()), 'ScriptName' => $_SERVER['PHP_SELF'])); 80 81 // Refresh time of last access 82 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('ActivityTime' => 'NOW()')); 93 83 94 84 //$this->LoadPermission($this->User['Role']);
Note:
See TracChangeset
for help on using the changeset viewer.