Changeset 681 for trunk/inc/realm.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/realm.php
r634 r681 11 11 parent::__construct($System); 12 12 $this->Id = $Id; 13 $this->Database = new Database($this->Config['Mangos']['RealmList'][$Id]['DatabaseHost'], $this->Config['Mangos']['RealmList'][$Id]['DatabaseUser'], $this->Config['Mangos']['RealmList'][$Id]['DatabasePassword'], $this->Config['Mangos']['RealmList'][$Id]['DatabaseCharacters']); 14 if($this->Database->connect_error) 13 $DbResult = $this->Database->query('SELECT * FROM Realm WHERE Id='.$Id); 14 $this->Data = $DbResult->fetch_assoc(); 15 $this->CharactersDatabase = new Database($this->Data['DatabaseHost'], $this->Data['DatabaseUser'], $this->Data['DatabasePassword'], $this->Data['DatabaseCharacters']); 16 $this->CharactersDatabase->select_db($this->Data['DatabaseCharacters']); 17 if($this->CharactersDatabase->connect_error) 15 18 { 16 //die('Přihlášení k databázi realmu '.$this->Id.' selhalo: '.$this->Database->connect_error);19 die('Přihlášení k databázi realmu '.$this->Id.' selhalo: '.$this->Database->connect_error); 17 20 } 18 $this->Database->charset($this->Config['Database']['Charset']); 21 $this->CharactersDatabase->charset($this->Config['Database']['Charset']); 22 23 $this->MangosDatabase = new Database($this->Data['DatabaseHost'], $this->Data['DatabaseUser'], $this->Data['DatabasePassword'], $this->Data['DatabaseMangos']); 24 $this->MangosDatabase->select_db($this->Data['DatabaseMangos']); 25 if($this->MangosDatabase->connect_error) 26 { 27 die('Přihlášení k databázi realmu '.$this->Id.' selhalo: '.$this->MangosDatabase->connect_error); 28 } 29 $this->MangosDatabase->charset($this->Config['Database']['Charset']); 19 30 } 20 31 21 32 function OnlineCharactersCount() 22 33 { 23 if($this-> Database->connect_error) return(0);34 if($this->CharactersDatabase->connect_error) return(0); 24 35 else { 25 $this->Database->select_db($this->Config['Mangos']['RealmList'][$this->Id]['DatabaseCharacters']); 26 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `characters` WHERE `online` = 1'); 36 $DbResult = $this->CharactersDatabase->query('SELECT COUNT(*) FROM `characters` WHERE `online` = 1'); 27 37 $DbRow = $DbResult->fetch_row(); 28 38 return($DbRow[0]); … … 47 57 public function CharacterCount() 48 58 { 49 if($this-> Database->connect_error) return('');59 if($this->CharactersDatabase->connect_error) return(''); 50 60 else { 51 $this->Database->select_db($this->Config['Mangos']['RealmList'][$this->Id]['DatabaseCharacters']); 52 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `characters`'); 61 $DbResult = $this->CharactersDatabase->query('SELECT COUNT(*) FROM `characters`'); 53 62 $DbRow = $DbResult->fetch_row(); 54 63 return($DbRow[0]); … … 58 67 public function GuidToCharName($guid) 59 68 { 60 if($this-> Database->connect_error) return(0);69 if($this->CharactersDatabase->connect_error) return(0); 61 70 else { 62 $this->Database->select_db($this->Config['Mangos']['RealmList'][$this->Id]['DatabaseCharacters']); 63 $row = $this->Database->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_array(); 71 $row = $this->CharactersDatabase->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_array(); 64 72 return($row['name']); 65 73 } … … 89 97 $edited = str_replace(")]", ";", $edited); // 5 - selected guid 90 98 $edited_arr = explode(";",$edited); 91 if($edited_arr[4] == "player") $sel_name = " - ".$this ->GuidToCharName($edited_arr[5]);99 if($edited_arr[4] == "player") $sel_name = " - ".$this->GuidToCharName($edited_arr[5]); 92 100 else $sel_name = ''; 93 $human_date = $this -> HumanDate 101 $human_date = $this -> HumanDate($edited_arr[0]); 94 102 echo('<tr> 95 103 <td><font size="2">'.$human_date.'</font></td> … … 107 115 $edited = str_replace(")", "", $edited); 108 116 $edited_arr = explode(";",$edited); 109 $human_date = $this -> HumanDate 117 $human_date = $this -> HumanDate($edited_arr[0]); 110 118 echo('<tr> 111 119 <td><font size="2">'.$human_date.'</font></td>
Note:
See TracChangeset
for help on using the changeset viewer.