- Timestamp:
- Jan 23, 2010, 1:32:45 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 13 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> -
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>'. -
trunk/pages/arena.php
r630 r681 19 19 20 20 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 21 $db = $Realm->Database; 22 $db->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseCharacters']); 21 $db = $Realm->CharactersDatabase; 23 22 24 23 $count = $db->query('SELECT COUNT(*) FROM arena_team')->fetch_row(); -
trunk/pages/commands.php
r630 r681 5 5 6 6 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 7 $db = $Realm->Database; 8 $db->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseMangos']); 7 $db = $Realm->MangosDatabase; 9 8 10 9 $Output .= '<ul>'; -
trunk/pages/events.php
r630 r681 91 91 echo($server->RealmSelection()); 92 92 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 93 $db = $Realm->Database; 94 $db->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseMangos']); 93 $db = $Realm->MangosDatabase; 95 94 96 95 $Events = Events(); -
trunk/pages/gmteam.php
r635 r681 50 50 51 51 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 52 $db2 = $Realm->Database; 53 $db2->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseCharacters']); 52 $db2 = $Realm->CharactersDatabase; 54 53 55 $db->select_db($Config['Database']['Database']);56 54 $Output = '<h2 class="PageTitle">GM tým</h2>'; 57 55 -
trunk/pages/guilda.php
r634 r681 11 11 12 12 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 13 $db2 = $Realm->Database; 14 $db2->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseCharacters']); 13 $db2 = $Realm->CharactersDatabase; 15 14 $id = (isset($_GET['id'])) ? $_GET['id'] : 0; 16 15 if($id != 0) -
trunk/pages/guildy.php
r634 r681 44 44 45 45 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 46 $db2 = $Realm->Database; 47 $db2->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseCharacters']); 46 $db2 = $Realm->CharactersDatabase; 48 47 49 48 $sql = $db2->query('SELECT `guild`.name, `guild`.guildid, `guild`.createdate, COUNT(`guild_member`.`guildid`) AS member_count ,`leader`.`race` IN (1, 3, 4, 7, 11) AS fraction , `leader`.`guid` AS leader FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `characters` AS `memebers` ON `memebers`.`guid`= `guild_member`.`guid` JOIN `characters` AS `leader` ON `leader`.`guid`= `guild`.`leaderguid` GROUP BY guild.name ORDER BY '.$order_by.' '.$order_dir.';'); -
trunk/pages/online.php
r632 r681 37 37 MakeLink('Body arén', 'arena_points').'</th></tr>'); 38 38 39 $Realm->Database->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 40 $sql = $Realm->Database->query('SELECT guid, name, race, class, zone, map, '. 39 $sql = $Realm->CharactersDatabase->query('SELECT guid, name, race, class, zone, map, '. 41 40 'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['HonorPoints'].'+1), " ", -1) AS UNSIGNED) AS highest_rank, '. 42 41 'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['Level'].' + 1), " ", -1) AS UNSIGNED) AS level, '. -
trunk/pages/realmlist.php
r677 r681 1 1 <?php 2 2 3 $Output = '<h2 align="center">Seznam světů</h2>'; 4 5 $Output .= '<table class="BaseTable">'. 6 '<tr>'. 7 '<th>Název</th>'. 8 '<th>Násobek XP</th>'. 9 '<th>Zaměření</th>'. 10 '<th>Stav</th>'. 11 '<th>Hráči online / max. online / celkem</th>'. 12 '</tr>'; 13 14 foreach($Config['Mangos']['RealmList'] as $Index => $RealmConfig) 3 if(array_key_exists('Server', $_GET)) 15 4 { 16 $db->select_db($Config['Mangos']['DatabaseRealmd']); 17 $DbResult = $db->query('SELECT * FROM `realmlist` WHERE id='.$RealmConfig['Id']); 5 $DbResult = $System->Database->query('SELECT Logon.Id, Host.Address, Logon.Port FROM Logon JOIN Host ON Host.Id=Logon.Host WHERE Logon.Id='.$_GET['Server']); 18 6 if($DbResult->num_rows > 0) 19 7 { 20 $Realm = new Realm($System, $Index); 21 $DbRow = $DbResult->fetch_assoc(); 22 $Output .= '<tr><td><a href="?page=online&RealmIndex='.$Index.'">'.$RealmConfig['Name'].'</a></td><td>'.$RealmConfig['XPRate'].'</td><td>'.$RealmConfig['Type'].'</td><td>'.$server->OnlineStateImage($System->NetworkPortState($DbRow['address'], $DbRow['port'])).'</td><td>'.$Realm->OnlineCharactersCount($Index).' / '.$RealmConfig['MaxOnlinePlayers'].' / '.$Realm->CharacterCount($Index).'</td></tr>'; 23 $Output .= '<tr><td colspan="5">'.$RealmConfig['Description'].'</td></tr>'; 24 //if(array_key_exists($Index + 1, $Config['Mangos']['RealmList'])) 25 $Output .= '<tr><td colspan="5"> </td></tr>'; 8 $Realm = $DbResult->fetch_assoc(); 9 echo('set realmlist '.$Realm['Address']); 10 if($Realm['Port'] != 3724) echo(':'.$Realm['Port']); 11 echo('</div>'); 12 } else echo('Neznámé Id serveru'); 13 } else 14 { 15 $Output = '<h2 align="center">Seznam světů</h2>'; 16 17 $DbResult = $System->Database->query('SELECT Logon.Id, Host.Address, Logon.Port FROM Logon JOIN Host ON Host.Id=Logon.Host'); 18 while($DbRow = $DbResult->fetch_assoc()) 19 { 20 $Server = new Server($System, $DbRow['Id']); 21 $Output .= '<div style="text-align: center">Realmlist <a href="?page=realmlist&Server='.$DbRow['Id'].'">'.$DbRow['Address']; 22 if($DbRow['Port'] != 3724) $Output .= ':'.$DbRow['Port']; 23 $Output .= '</a></div>'; 24 $Output .= '<table class="BaseTable">'. 25 '<tr>'. 26 '<th>Název</th>'. 27 '<th>Násobek XP</th>'. 28 '<th>Zaměření</th>'. 29 '<th>Stav</th>'. 30 '<th>Hráči online / max. online / celkem</th>'. 31 '</tr>'; 32 33 $DbResult2 = $System->Database->query('SELECT * FROM Realm WHERE Logon='.$Server->Id.' ORDER BY Name'); 34 while($DbRow = $DbResult2->fetch_assoc()) 35 { 36 $Realm = new Realm($System, $DbRow['Id']); 37 $Output .= '<tr><td><a href="?page=online&RealmIndex='.$Realm->Id.'">'.$Realm->Data['Name'].'</a></td><td>'.$Realm->Data['Rate'].'</td><td>'.$Realm->Data['Type'].'</td><td>'.$Server->OnlineStateImage($Realm->Data['Online']).'</td><td>'.$Realm->OnlineCharactersCount().' / '.$Realm->Data['MaxOnlinePlayers'].' / '.$Realm->CharacterCount().'</td></tr>'; 38 $Output .= '<tr><td colspan="5">'.$Realm->Data['Description'].'</td></tr>'; 39 //if(array_key_exists($Index + 1, $Config['Mangos']['RealmList'])) 40 $Output .= '<tr><td colspan="5"> </td></tr>'; 41 } 42 $Output .= '</table><br/>'; 26 43 } 44 echo($Output); 27 45 } 28 $Output .= '</table>';29 echo($Output);30 46 31 47 ?> -
trunk/pages/server.php
r650 r681 57 57 </tr> 58 58 <tr><td colspan="2" style="padding: 5px;">'; 59 60 foreach($Config['Web']['ServerList'] as $Index => $Server) 59 60 $DbResult = $System->Database->query('SELECT * FROM Host'); 61 while($Host = $DbResult->fetch_assoc()) 61 62 { 62 63 $Realms = array(); 63 foreach($Config['Mangos']['RealmList'] as $RealmIndex => $Realm) 64 $DbResult2 = $System->Database->query('SELECT * FROM Realm'); 65 while($Realm = $DbResult2->fetch_assoc()) 64 66 { 65 if($Realm[' Server'] == $Index) $Realms[] = $Realm['Name'];67 if($Realm['Host'] == $Host['Id']) $Realms[] = $Realm['Name']; 66 68 } 67 69 … … 72 74 <tr> 73 75 <td>Operační systém</td> 74 <td>'.$ Server['OS'].'</td>76 <td>'.$Host['OS'].'</td> 75 77 </tr> 76 78 <tr> 77 79 <td>Procesor</td> 78 <td>'.$ Server['CPU'].'</td>80 <td>'.$Host['CPU'].'</td> 79 81 </tr> 80 82 <tr> 81 83 <td>Operační paměť</td> 82 <td>'.$ Server['Memory'].'</td>84 <td>'.$Host['Memory'].'</td> 83 85 </tr> 84 86 <tr> 85 87 <td>Pevný disk</td> 86 <td>'.$ Server['HDD'].'</td>88 <td>'.$Host['HDD'].'</td> 87 89 </tr> 88 90 <tr> 89 91 <td>Adresa serveru</td> 90 <td>'.$ Server['Address'].'</td>92 <td>'.$Host['Address'].'</td> 91 93 </tr> 92 94 <tr> 93 95 <td>Internetová linka</td> 94 <td>'.$ Server['Internet'].'</td>96 <td>'.$Host['Internet'].'</td> 95 97 </tr> 96 98 <tr> … … 100 102 <tr> 101 103 <td>Grafy</td> 102 <td><a href="'.$ Server['Statistic'].'">'.$Server['Statistic'].'</a></td>104 <td><a href="'.$Host['Statistic'].'">'.$Host['Statistic'].'</a></td> 103 105 </tr> 104 106 </table>'; -
trunk/pages/tophraci.php
r630 r681 22 22 23 23 $Realm = new Realm($System, $_COOKIE['RealmIndex']); 24 $db = $Realm->Database; 25 $db->select_db($Config['Mangos']['RealmList'][$Realm->Id]['DatabaseCharacters']); 24 $db = $Realm->CharactersDatabase; 26 25 27 26 $sql = 'SELECT name, totaltime, online FROM characters ORDER BY totaltime DESC LIMIT '.$top;
Note:
See TracChangeset
for help on using the changeset viewer.