Changeset 539 for trunk/includes/user.php
- Timestamp:
- May 15, 2013, 12:44:32 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/user.php
r524 r539 46 46 { 47 47 if($this->Role != LICENCE_ANONYMOUS) 48 $this->System->Database->query('UPDATE `User` SET `LastLogout` = NOW() WHERE `ID` = '.$this->Id); 48 $this->System->Database->query('UPDATE `UserTrace` SET '. 49 '`LastLogout` = NOW() WHERE `User` = '.$this->Id); 49 50 $this->SetAnonymous(); 50 51 } … … 53 54 { 54 55 $DbResult = $this->System->Database->query('SELECT * FROM `User` WHERE `ID` = '.$this->Id); 55 $User = $DbResult->fetch_assoc(); 56 // Security: Password and Salt hash should not be loaded to variables 57 $this->Id = $User['ID']; 58 $this->Team = $User['Team']; 59 $this->Redirecting = $User['Redirecting']; 60 $this->Language = $User['Language']; 61 $this->Name = $User['Name']; 62 $this->Role = $User['GM']; 63 $this->Email = $User['Email']; 64 $this->Info = $User['Info']; 65 $this->PreferredVersion = $User['PreferredVersion']; 56 if($DbResult->num_rows > 0) 57 { 58 $User = $DbResult->fetch_assoc(); 59 // Security: Password and Salt hash should not be loaded to variables 60 $this->Id = $User['ID']; 61 $this->Team = $User['Team']; 62 $this->Redirecting = $User['Redirecting']; 63 $this->Language = $User['Language']; 64 $this->Name = $User['Name']; 65 $this->Role = $User['GM']; 66 $this->Email = $User['Email']; 67 $this->Info = $User['Info']; 68 $this->PreferredVersion = $User['PreferredVersion']; 69 } else $this->SetAnonymous(); 66 70 } 67 71 … … 113 117 function UpdateState() 114 118 { 115 if(array_key_exists('REMOTE_ADDR', $_SERVER)) 116 $this->System->Database->query('UPDATE `User` SET `LastIP` = "'.$_SERVER['REMOTE_ADDR'].'", `LastLogin` = NOW() WHERE `ID` = '.$this->Id); 119 if(array_key_exists('REMOTE_ADDR', $_SERVER) and ($this->Role != LICENCE_ANONYMOUS)) 120 $this->System->Database->query('UPDATE `UserTrace` SET '. 121 '`LastIP` = "'.$_SERVER['REMOTE_ADDR'].'", '. 122 '`LastLogin` = NOW(), '. 123 '`UserAgent` = "'.$this->System->Database->real_escape_string($_SERVER['HTTP_USER_AGENT']).'" '. 124 'WHERE `User` = '.$this->Id); 125 } 126 127 function Register($UserName, $Password, $Email, $Language, $Team, $PreferredVersion) 128 { 129 $Salt = $this->GetPasswordSalt(); 130 $this->System->Database->query('INSERT INTO `User` '. 131 '(`Name` , `Pass` , `Salt`, `Email` , `Language` , `Team` , `NeedUpdate`, `RegistrationTime`, `PreferredVersion` ) '. 132 'VALUES ("'.$UserName.'", '.$this->CryptPasswordSQL('"'.$Password.'"', '"'.$Salt.'"'). 133 ', "'.$Salt.'", "'.$Email.'", '.$Language.', '.$Team.', 1, NOW(), '.$PreferredVersion.')'); 134 $UserId = $this->System->Database->insert_id; 135 $this->System->Database->query('INSERT INTO `UserTrace` (`User`, `LastIP`, `UserAgent`) '. 136 'VALUES ('.$UserId.', "'.$_SERVER['REMOTE_ADDR'].'", '. 137 '"'.$this->System->Database->real_escape_string($_SERVER['HTTP_USER_AGENT']).'")'); 117 138 } 118 139 }
Note:
See TracChangeset
for help on using the changeset viewer.