Changeset 38 for branches/3/class/user.php
- Timestamp:
- Nov 25, 2008, 5:12:10 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3/class/user.php
r34 r38 2 2 3 3 class user 4 { // BEGIN class User4 { // BEGIN class user 5 5 // variables 6 6 var $ID,$user,$Database; 7 var $Anonymous UserId = 0;7 var $AnonymoususerId = 0; 8 8 var $DefaultRole = 2; 9 9 var $IPAddress = ' '; … … 22 22 $this->IPAddress = gethostbyaddr($_SERVER['REMOTE_ADDR']).' '.$_SERVER['REMOTE_ADDR']; 23 23 // Lookup user record 24 $Query = $this->Database->select(' UserOnline', '*', 'SessionId="'.$SID.'"');24 $Query = $this->Database->select('useronline', '*', 'SessionId="'.$SID.'"'); 25 25 if($this->Database->LastDataSet) 26 26 { 27 27 // Refresh time of last access 28 $this->Database->update(' UserOnline', 'SessionId="'.$SID.'"', array('Time' => 'NOW()','IpAddress' => $this->IPAddress));28 $this->Database->update('useronline', 'SessionId="'.$SID.'"', array('Time' => 'NOW()','IpAddress' => $this->IPAddress)); 29 29 } else { 30 $this->Database->insert(' UserOnline', array('SessionId' => $SID, 'User' => $this->AnonymousUserId, 'Time' => 'NOW()', 'IpAddress' => $this->IPAddress));30 $this->Database->insert('useronline', array('SessionId' => $SID, 'user' => $this->AnonymoususerId, 'Time' => 'NOW()', 'IpAddress' => $this->IPAddress)); 31 31 } 32 32 // Odeber neaktivní uživatele 33 $this->Database->delete(' UserOnline', 'Time < DATE_SUB(NOW(), INTERVAL '.USER_TIMEOUT.' SECOND)');33 $this->Database->delete('useronline', 'Time < DATE_SUB(NOW(), INTERVAL '.USER_TIMEOUT.' SECOND)'); 34 34 35 35 // Zkontroluj přihlášení 36 $Query = $this->Database->select(' UserOnline', '*', 'SessionId="'.$SID.'"');36 $Query = $this->Database->select('useronline', '*', 'SessionId="'.$SID.'"'); 37 37 $Row = $Query->fetch_array(); 38 if($Row[' User'] != $this->AnonymousUserId)38 if($Row['user'] != $this->AnonymoususerId) 39 39 { 40 $Query = $this->Database->select(' User', '*', "Id=".$Row['User']."");40 $Query = $this->Database->select('user', '*', "Id=".$Row['user'].""); 41 41 $this->user = $Query->fetch_array(); 42 42 $Result = USER_LOGGED; 43 43 $this->LoadPermission($this->user['Permission']); 44 44 } else { 45 $Query = $this->Database->select(' User', '*', "Id=".$this->AnonymousUserId);45 $Query = $this->Database->select('user', '*', "Id=".$this->AnonymoususerId); 46 46 $this->user = $Query->fetch_array(); 47 47 $Result = USER_NOT_LOGGED; … … 60 60 { 61 61 // Je uživatel registrován? 62 $Query = $this->Database->select(' User', '*', 'Name = "'.$Data['Nick'].'"');62 $Query = $this->Database->select('user', '*', 'Name = "'.$Data['Nick'].'"'); 63 63 if($this->Database->LastDataSet) $Result = NICK_USED; 64 64 else 65 65 { 66 $this->Database->insert(' User', array('Name' => addslashes($Data['Nick']), 'FullName' => addslashes($Data['FullName']), 'Password' => addslashes($Data['Password']), 'Email' => htmlspecialchars($Data['Email']), 'Permission' => $this->DefaultRole, 'TranslationLanguage' => $Data['Language'], 'LastIpAddress' => $this->IPAddress, 'LastLoginTime' => 'NOW()'));66 $this->Database->insert('user', array('Name' => addslashes($Data['Nick']), 'FullName' => addslashes($Data['FullName']), 'Password' => addslashes($Data['Password']), 'Email' => htmlspecialchars($Data['Email']), 'Permission' => $this->DefaultRole, 'TranslationLanguage' => $Data['Language'], 'LastIpAddress' => $this->IPAddress, 'LastLoginTime' => 'NOW()')); 67 67 //echo $this->Database->LastQuery; 68 68 $Result = USER_REGISTRATED; … … 76 76 $SID = session_id(); 77 77 // Je uživatel registrován? 78 $Query = $this->Database->select(' User', '*', 'Name="'.$Data['Nick'].'"');78 $Query = $this->Database->select('user', '*', 'Name="'.$Data['Nick'].'"'); 79 79 if($Query->num_rows > 0) 80 80 { … … 83 83 else 84 84 { 85 $this->Database->update(' User', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()', 'LastIpAddress' => $this->IPAddress));86 $this->Database->update(' UserOnline', 'SessionId="'.$SID.'"', array('User' => $Row['Id']));85 $this->Database->update('user', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()', 'LastIpAddress' => $this->IPAddress)); 86 $this->Database->update('useronline', 'SessionId="'.$SID.'"', array('user' => $Row['Id'])); 87 87 // načtení stavu stromu 88 88 $Result = USER_LOGGED_IN; … … 97 97 { 98 98 $SID = session_id(); 99 $this->Database->update(' UserOnline', 'SessionId="'.$SID.'"', array('User' => $this->AnonymousUserId));99 $this->Database->update('useronline', 'SessionId="'.$SID.'"', array('user' => $this->AnonymoususerId)); 100 100 $this->Check(); 101 101 return(USER_LOGGED_OUT); … … 105 105 { 106 106 $this->user['Permission'] = array(); 107 $DbResult = $this->Database->select(' Permission','*','ID='.$Permission);107 $DbResult = $this->Database->select('permission','*','ID='.$Permission); 108 108 if($this->Database->LastDataSet) 109 109 while($DbRow = $DbResult->fetch_array()) … … 121 121 } // END function Permission 122 122 123 } // END class User123 } // END class user 124 124 125 125 ?>
Note:
See TracChangeset
for help on using the changeset viewer.