source: trunk/pages/svety.php

Last change on this file was 704, checked in by george, 15 years ago
  • Přidáno: Uvítací odstavec na hlavní stránce s možností skrytí přes cookies. Také přidán nakonec stránky přehled vlastností serveru.
  • Upraveno: Sjednocení stylu titulků stránek.
File size: 3.5 KB
Line 
1<?php
2
3function RealmList()
4{
5 global $System, $html;
6
7if(array_key_exists('Server', $_GET))
8{
9 $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'].' AND Logon.Enabled=1');
10 if($DbResult->num_rows > 0)
11 {
12 $Realm = $DbResult->fetch_assoc();
13 echo('set realmlist '.$Realm['Address']);
14 if($Realm['Port'] != 3724) echo(':'.$Realm['Port']);
15 echo('</div>');
16 } else echo('Neznámé Id serveru');
17} else
18{
19 $Output = '<h2 class="PageTitle">Seznam světů</h2>';
20
21 $DbResult = $System->Database->query('SELECT Logon.ClientVersion, Logon.Name, Logon.Id, Host.Address, Logon.Port FROM Logon JOIN Host ON Host.Id=Logon.Host WHERE Logon.Enabled=1');
22 while($DbRow = $DbResult->fetch_assoc())
23 {
24 $Server = new Server($System, $DbRow['Id']);
25 $Output .= '<div style="text-align: center">'.$DbRow['Name'].' '.$DbRow['ClientVersion'].' - realmlist: <a href="'.$html->Link('/svety/?Server='.$DbRow['Id']).'">'.$DbRow['Address'];
26 if($DbRow['Port'] != 3724) $Output .= ':'.$DbRow['Port'];
27 $Output .= '</a></div>';
28 $Output .= '<table class="BaseTable">'.
29 '<tr>'.
30 '<th>Název</th>'.
31 '<th>Násobek XP</th>'.
32 '<th>Zaměření</th>'.
33 '<th>Jazyk</th>'.
34 '<th>Stav</th>'.
35 '<th>Hráči online</th>'.
36 '</tr>';
37
38 $DbResult2 = $System->Database->query('SELECT *, '.$System->SQLURLName('Name').' AS URLName FROM Realm WHERE Logon='.$Server->Id.' AND Enabled=1 ORDER BY Name');
39 while($DbRow = $DbResult2->fetch_assoc())
40 {
41 $Realm = new Realm($System, $DbRow['Id']);
42 $Output .= '<tr><td><a href="'.$html->Link('/svety/'.$DbRow['URLName'].'/').'">'.$Realm->Data['Name'].'</a></td><td>'.$Realm->Data['Rate'].'</td><td>'.$Realm->Data['Type'].'</td><td>'.$Realm->Data['Locale'].'</td><td>'.$Server->OnlineStateImage($Realm->Data['Online']).'</td><td><a href="'.$html->Link('/svety/'.$DbRow['URLName'].'/online-hraci/').'">'.$Realm->OnlineCharactersCount().'</a></td></tr>';
43 $Output .= '<tr><td colspan="6">'.$Realm->Data['Description'].'</td></tr>';
44 //if(array_key_exists($Index + 1, $Config['Mangos']['RealmList']))
45 $Output .= '<tr><td colspan="6">&nbsp;</td></tr>';
46 }
47 $Output .= '</table><br/>';
48 }
49 echo($Output);
50}
51}
52
53function RealmInfo()
54{
55 global $System;
56
57 $DbResult = $System->Database->query('SELECT * FROM Realm WHERE Id='.$_COOKIE['RealmIndex']);
58 $Realm = $DbResult->fetch_assoc();
59 echo('<h2 align="center">'.$Realm['Name'].'</h2>');
60 echo($Realm['Information']);
61}
62
63if(count($QueryItems) > 1)
64{
65 $RealmName = $QueryItems[1];
66 $DbResult = $System->Database->query('SELECT Id FROM Realm WHERE '.$System->SQLURLName('Name').'="'.$RealmName.'"');
67 $DbRow = $DbResult->fetch_assoc();
68 $_COOKIE['RealmIndex'] = $DbRow['Id'];
69
70 if(count($QueryItems) > 2)
71 {
72 if($QueryItems[2] == 'online-hraci') include('online-hraci.php');
73 else if($QueryItems[2] == 'prikazy') include('prikazy.php');
74 else if($QueryItems[2] == 'akce') include('akce.php');
75 else if($QueryItems[2] == 'arena') include('arena.php');
76 else if($QueryItems[2] == 'nej-hraci') include('nej-hraci.php');
77 else if($QueryItems[2] == 'mapa') include('mapa.php');
78 else if($QueryItems[2] == 'spolek') include('spolek.php');
79 else if($QueryItems[2] == 'spolky') include('spolky.php');
80 else RealmInfo();
81 } else RealmInfo();
82} else RealmList();
83
84?>
Note: See TracBrowser for help on using the repository browser.