Changeset 15 for trunk/www/server.php
- Timestamp:
- Jun 12, 2009, 8:09:48 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/server.php
r14 r15 18 18 $this->Id = $Id; 19 19 $DbResult = $this->Database->query('SELECT * FROM `Server` WHERE `Id`='.$Id); 20 $this->Server = $DbResult->fetch_assoc(); 21 $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE `Id`='.$this->Server['Database']); 22 if($DbResult->num_rows > 0) $this->Server['Database'] = $DbResult->fetch_assoc(); 23 else $this->Server['Database'] = array('Emulator' => 0); 24 $DbResult = $this->Database->query('SELECT * FROM `Emulator` WHERE `Id`='.$this->Server['Database']['Emulator']); 25 if($DbResult->num_rows > 0) $this->Server['Database']['Emulator'] = $DbResult->fetch_assoc(); 26 else $this->Server['Database']['Emulator'] = array('ClientVersion' => 0); 27 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Server['Database']['Emulator']['ClientVersion']); 28 if($DbResult->num_rows > 0) $this->Server['Database']['Emulator']['ClientVersion'] = $DbResult->fetch_assoc(); 29 else $this->Server['Database']['Emulator']['ClientVersion'] = array(); 20 if($DbResult->num_rows > 0) 21 { 22 $this->Server = $DbResult->fetch_assoc(); 23 $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE `Id`='.$this->Server['Database']); 24 if($DbResult->num_rows > 0) $this->Server['Database'] = $DbResult->fetch_assoc(); 25 else $this->Server['Database'] = array('Emulator' => 0); 26 $DbResult = $this->Database->query('SELECT * FROM `Emulator` WHERE `Id`='.$this->Server['Database']['Emulator']); 27 if($DbResult->num_rows > 0) $this->Server['Database']['Emulator'] = $DbResult->fetch_assoc(); 28 else $this->Server['Database']['Emulator'] = array('ClientVersion' => 0); 29 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Server['Database']['Emulator']['ClientVersion']); 30 if($DbResult->num_rows > 0) $this->Server['Database']['Emulator']['ClientVersion'] = $DbResult->fetch_assoc(); 31 else $this->Server['Database']['Emulator']['ClientVersion'] = array(); 32 } 30 33 } 31 34 … … 125 128 $DbResult = $this->Database->query('SELECT COUNT(*) FROM server'.$this->Id.'_characters.characters AS T WHERE T.online = 1'); 126 129 $DbRow = $DbResult->fetch_row(); 127 $State[' OnlinePlayerCount'] = $DbRow[0];130 $State['CharacterOnlineCount'] = $DbRow[0]; 128 131 $DbResult = $this->Database->query('SELECT COUNT(*) FROM server'.$this->Id.'_characters.characters AS T'); 129 132 $DbRow = $DbResult->fetch_row(); … … 237 240 $Config->Save($ServerEtcDir.'scriptdev2.conf'); 238 241 } 242 243 function UpdateServerList() 244 { 245 $DbResult = $this->Database->select('Server', 'Id'); 246 while($DbRow = $DbResult->fetch_assoc()) 247 { 248 $Server = new Server($this->Database, $DbRow['Id']); 249 $ServerState = $Server->GetState(); 250 $this->Database->update('Server', 'Id='.$DbRow['Id'], array( 251 'Online' => $ServerState['Online'], 252 'CharacterOnlineCount' => $ServerState['CharacterOnlineCount'], 253 'CharacterCount' => $ServerState['CharacterCount'], 254 'AccountCount' => $ServerState['AccountCount'], 255 )); 256 } 257 } 239 258 } 240 259
Note:
See TracChangeset
for help on using the changeset viewer.