Changeset 681 for trunk/inc/server.php
- Timestamp:
- Jan 23, 2010, 1:32:45 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 mm 2 Thumbs.db 1 gallery 2 armory 3 tester 4 test 5 minimanager 6 mmfpm
-
- Property svn:ignore
-
trunk/inc/server.php
r680 r681 13 13 parent::__construct($System); 14 14 $this->Id = $Id; 15 $DbResult = $this->Database->query('SELECT * FROM Logon WHERE Id='.$Id); 16 $this->Data = $DbResult->fetch_assoc(); 17 $this->ServerDatabase = new Database($this->Data['DatabaseHost'], $this->Data['DatabaseUser'], $this->Data['DatabasePassword'], $this->Data['DatabaseRealmd']); 18 $this->ServerDatabase->select_db($this->Data['DatabaseRealmd']); 19 if($this->ServerDatabase->connect_error) 20 { 21 die('Přihlášení k databázi serveru '.$this->Id.' selhalo: '.$this->ServerDatabase->connect_error); 22 } 23 $this->ServerDatabase->charset($this->Config['Database']['Charset']); 15 24 } 16 25 … … 44 53 { 45 54 $TotalCount = 0; 46 foreach($this->Config['Mangos']['RealmList'] as $Index => $Realm) 55 $DbResult = $this->Database->query('SELECT Id FROM Realm'); 56 while($DbRow = $DbResult->fetch_assoc()) 47 57 { 48 $Realm = new Realm($this->System, $ Index);58 $Realm = new Realm($this->System, $DbRow['Id']); 49 59 $TotalCount += $Realm->OnlineCharactersCount(); 50 60 } … … 61 71 { 62 72 $TotalCount = 0; 63 foreach($this->Config['Mangos']['RealmList'] as $Index => $Realm) 73 $DbResult = $this->Database->query('SELECT Id FROM Realm'); 74 while($DbRow = $DbResult->fetch_assoc()) 64 75 { 65 $Realm = new Realm($this->System, $ Index);66 $TotalCount += $Realm->CharacterCount($ Index);76 $Realm = new Realm($this->System, $DbRow['Id']); 77 $TotalCount += $Realm->CharacterCount($DbRow['Id']); 67 78 } 68 79 return($TotalCount); … … 71 82 public function AccountCount() 72 83 { 73 $this->Database->select_db($this->Config['Mangos']['DatabaseRealmd']); 74 $row = $this->Database->query('SELECT COUNT(*) FROM account')->fetch_row(); 84 $row = $this->ServerDatabase->query('SELECT COUNT(*) FROM account')->fetch_row(); 75 85 return($row[0]); 76 86 } … … 362 372 { 363 373 $Output = ''; 364 if(count($this->Config['Mangos']['RealmList']) > 1) 374 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Realm'); 375 $DbRow = $DbResult->fetch_row(); 376 $RealmCount = $DbRow[0]; 377 378 if($RealmCount > 1) 365 379 { 366 380 if(array_key_exists('page', $_GET)) $Target = '?page='.$_GET['page']; … … 368 382 $Output .= '<div style="text-align: center;"><form id="RealmSelection'.$FormNameSufix.'" action="'.$Target.'" method="post">'. 369 383 '<div>Výběr světa <select name="RealmIndex" onchange="document.getElementById(\'RealmSelection'.$FormNameSufix.'\').submit()">'; 370 foreach($this->Config['Mangos']['RealmList'] as $Index => $Realm) 384 385 $DbResult = $this->Database->query('SELECT * FROM Realm'); 386 while($Realm = $DbResult->fetch_assoc()) 371 387 { 372 if($_COOKIE['RealmIndex'] == $ Index) $Selected = ' selected="selected"';388 if($_COOKIE['RealmIndex'] == $Realm['Id']) $Selected = ' selected="selected"'; 373 389 else $Selected = ''; 374 $Output .= '<option value="'.$ Index.'"'.$Selected.'>'.$Realm['Name'].'</option>';390 $Output .= '<option value="'.$Realm['Id'].'"'.$Selected.'>'.$Realm['Name'].'</option>'; 375 391 } 376 392 $Output .= '</select></div>'.
Note:
See TracChangeset
for help on using the changeset viewer.