1 | <?php
|
---|
2 |
|
---|
3 | session_start();
|
---|
4 | include('config.php');
|
---|
5 | include('database.php');
|
---|
6 | include('error.php');
|
---|
7 | $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']);
|
---|
8 | $Database->Prefix = $Config['Database']['Prefix'];
|
---|
9 | $Database->charset($Config['Database']['Charset']);
|
---|
10 |
|
---|
11 | $Menu = array(
|
---|
12 | array('index.php', 'Home', 'home'),
|
---|
13 | array('server.php', 'Server', 'server'),
|
---|
14 | array('finance/', 'Finance', 'donate'),
|
---|
15 | array('db/', 'Online databáze', 'database'),
|
---|
16 | array('download_soubory/', 'Stahování', 'download'),
|
---|
17 | array('jak_zacit.php', 'Jak zaèít', 'how'),
|
---|
18 | array('link.php', 'Odkazy', 'link'),
|
---|
19 | array('mapa.php', 'Mapa', 'mapa'),
|
---|
20 | array('guildy.php', 'Seznam guild', 'guilds'),
|
---|
21 | array('forum/', 'Diskusní fórum', 'forum'),
|
---|
22 | array('registrace/', 'Registrace', 'registrace'),
|
---|
23 | array('online_player.php', 'Online hráèi', 'online_player'),
|
---|
24 | array('honor.php', 'Tabulka cti', 'honor'),
|
---|
25 | array('Death%20Dealers%20Hratelne%20Rasy.php', 'Rasy', 'rasy'),
|
---|
26 | array('Death%20Dealers%20Povolani.php', 'Povolání', 'povolani'),
|
---|
27 | array('Death%20Dealers%20Profese.php', 'Profese', 'profese'),
|
---|
28 | );
|
---|
29 |
|
---|
30 | function HumanDate($DateTime)
|
---|
31 | {
|
---|
32 | $DateTimeParts = explode(' ', $DateTime);
|
---|
33 | $Parts = explode('-', $DateTimeParts[0]);
|
---|
34 | if($DateTimeParts[0] != '0000-00-00') return(($Parts[2]*1).'.'.($Parts[1]*1).'.'.$Parts[0]);
|
---|
35 | else return(' ');
|
---|
36 | }
|
---|
37 |
|
---|
38 | function ShowOnlinePlayerCount()
|
---|
39 | {
|
---|
40 | global $Database;
|
---|
41 | //ini_set('allow_url_fopen', 'On');
|
---|
42 | // World of Warcraft user stat
|
---|
43 | //$Content = @file_get_contents('http://wow.zdechov.net:8080/stat.xml');
|
---|
44 | //$File = fopen('http://'.$WoWServer.'/mangos/inc/stat.xml', 'r');
|
---|
45 | //$Content = fgets($File, 1000000);
|
---|
46 | //fclose($File);
|
---|
47 | $Database->select_db('realmd');
|
---|
48 | $Result = $Database->select('account', 'COUNT(*)', 'online=1');
|
---|
49 | $Row = $Result->fetch_array();
|
---|
50 | $PlayerCount = $Row[0];
|
---|
51 |
|
---|
52 | if($PlayerCount == 1) $P = 'hráè';
|
---|
53 | else if(($PlayerCount >= 2) and ($PlayerCount <= 4)) $P = 'hráèi';
|
---|
54 | else $P = 'hráèù';
|
---|
55 | echo($PlayerCount.' '.$P);
|
---|
56 | }
|
---|
57 |
|
---|
58 | function FormatOutput($s)
|
---|
59 | {
|
---|
60 | $out = '';
|
---|
61 | $nn = 0;
|
---|
62 | $n = 0;
|
---|
63 | while($s!='')
|
---|
64 | {
|
---|
65 | $start = strpos($s,'<');
|
---|
66 | $end = strpos($s,'>');
|
---|
67 | if($start != 0)
|
---|
68 | {
|
---|
69 | $end = $start-1;
|
---|
70 | $start = 0;
|
---|
71 | }
|
---|
72 | $line = trim(substr($s,$start,$end+1));
|
---|
73 | if(strlen($line)>0)
|
---|
74 | if($line[0] == '<')
|
---|
75 | {
|
---|
76 | if($s[$start+1] == '/')
|
---|
77 | {
|
---|
78 | $n = $n - 2;
|
---|
79 | $nn = $n;
|
---|
80 | } else
|
---|
81 | {
|
---|
82 | if(strpos($line,' ')) $cmd = substr($line,1,strpos($line,' ')-1);
|
---|
83 | else $cmd = substr($line,1,strlen($line)-2);
|
---|
84 | //echo('['.$cmd.']');
|
---|
85 | if(strpos($s,'</'.$cmd.'>')) $n = $n + 2;
|
---|
86 | }
|
---|
87 | }// else $line = '['.$line.']';
|
---|
88 | //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
|
---|
89 | if($line != '') $out .= (str_repeat(' ',$nn).$line."\n");
|
---|
90 | $s = substr($s,$end+1,strlen($s));
|
---|
91 | $nn = $n;
|
---|
92 | }
|
---|
93 | return($out);
|
---|
94 | }
|
---|
95 |
|
---|
96 | function CheckPortStatus($Ip, $Port)
|
---|
97 | {
|
---|
98 | function ErrorHandler($errno,$errmsg,$filename,$linenum,$vars)
|
---|
99 | {
|
---|
100 | }
|
---|
101 | set_error_handler('ErrorHandler');
|
---|
102 | //error_reporting(0);
|
---|
103 | if($Fp1 = fsockopen($Ip, $Port, $ERROR_NO, $ERROR_STR,(float)0.5))
|
---|
104 | {
|
---|
105 | fclose($Fp1);
|
---|
106 | return true;
|
---|
107 | } else
|
---|
108 | {
|
---|
109 | //echo($ERROR_NO.','.$ERROR_STR);
|
---|
110 | //die();
|
---|
111 | return false;
|
---|
112 | }
|
---|
113 | restore_error_handler();
|
---|
114 | }
|
---|
115 |
|
---|
116 | function GenerateMenu()
|
---|
117 | {
|
---|
118 | global $Config, $Menu;
|
---|
119 | $Result = '';
|
---|
120 | foreach($Menu as $Index => $MenuItem)
|
---|
121 | {
|
---|
122 | $Result .= "<a href=\"".$Config['Web']['BaseURL'].$MenuItem[0]."\" onMouseOver=\"swtch("".($Index*2+2)."","".$MenuItem[2]."")\" onMouseOut=\"swtch("".($Index*2+1)."","".$MenuItem[2]."")\"><IMG SRC=\"".$Config['Web']['BaseURL']."images/".$MenuItem[2].".jpg\" name=\"".$MenuItem[2]."\" alt=\"".$MenuItem[1]."\" border=\"0\"></A><br>\n";
|
---|
123 | }
|
---|
124 | return($Result);
|
---|
125 | }
|
---|
126 |
|
---|
127 | function ShowHeader()
|
---|
128 | {
|
---|
129 | global $Config;
|
---|
130 | echo('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
---|
131 | <HTML>
|
---|
132 | <HEAD>
|
---|
133 | <META http-equiv="Content-Language" content="cs">
|
---|
134 | <META http-equiv="Content-Type" content="text/html; charset='.$Config['Web']['Charset'].'">
|
---|
135 | <META HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1990 00:00:01 GMT">
|
---|
136 | <link rel="SHORTCUT ICON" href="images/favicon.ico">
|
---|
137 | <link rel="alternate" title="RSS aktuality" href="rss.php" type="application/rss+xml">
|
---|
138 | <TITLE>WoW server Heroes of Fantasy</TITLE>
|
---|
139 | <style type="text/css" media="screen">@import url('.$Config['Web']['BaseURL'].'css/style.css);</style>
|
---|
140 | <script language="JavaScript" type="text/javascript" src="'.$Config['Web']['BaseURL'].'css/global_js.php"></script>
|
---|
141 | </HEAD>
|
---|
142 | <BODY text="#cccccc">
|
---|
143 |
|
---|
144 |
|
---|
145 | <TABLE cellspacing="0" cellpadding="0" align="center" class="TableHlavni" border="0">
|
---|
146 | <TR>
|
---|
147 | <TD id="BlankSpace"> </td>
|
---|
148 | <TD rowspan="2" id="TdSloupec" valign="top">
|
---|
149 | <div class="Nadpis">Heroes of Fantasy</div>
|
---|
150 | <div class="DivText">');
|
---|
151 |
|
---|
152 | ShowOnlinePlayerCount();
|
---|
153 |
|
---|
154 |
|
---|
155 | echo('</div>');
|
---|
156 |
|
---|
157 | echo(GenerateMenu());
|
---|
158 |
|
---|
159 | echo('<A HREF="http://www.toplist.cz/" target="_blank"><IMG alt="pocitadlo"
|
---|
160 | SRC="http://toplist.cz/count.asp?logo=mc&ID=324802"
|
---|
161 | border="0" width="0" height="0"></A>
|
---|
162 |
|
---|
163 | </td>
|
---|
164 | </tr>
|
---|
165 | <tr><td id="LeftCell"><div class="pHlavni">');
|
---|
166 | }
|
---|
167 |
|
---|
168 | function ShowFooter()
|
---|
169 | {
|
---|
170 | global $Config;
|
---|
171 | echo('</div>
|
---|
172 | </td>
|
---|
173 | </tr>
|
---|
174 | <tr>
|
---|
175 | <td colspan="2">
|
---|
176 | <DIV class="DivPaticka">
|
---|
177 | <A href="'.$Config['Web']['BaseURL'].'administrace/" class="Paticka">#</A>
|
---|
178 | | Správce serveru: '.$Config['Web']['Admin'].' | Email: '.$Config['Web']['AdminEmail'].' | Poèet pøístupù: <A HREF="http://counter.cnw.cz/" TARGET=_parent>
|
---|
179 | <IMG SRC="http://counter.cnw.cz/monika.cgi?wowzdechov&5&000000&FFFFFF&on" BORDER=0 ALT="CNW:Counter"></A><SCRIPT type="JavaScript">
|
---|
180 | <!--
|
---|
181 | document.write("<A href=\"http://counter.cnw.cz\" target=\"_parent\" >
|
---|
182 | <IMG src=\"http://counter.cnw.cz/trackit.cgi?wowzdechov&t3&" + escape(top.document.referrer) + "\" alt=\"CNW:Tracker\" border=\"0\" width=\"0\" height=\"0\" alt=\"counter\"><\/A>");
|
---|
183 | // -->
|
---|
184 | </SCRIPT>
|
---|
185 | | Provozováno na <a href="http://game-server.zdechov.net/">game-server.zdechov.net</a> |
|
---|
186 |
|
---|
187 | </DIV>
|
---|
188 | </td>
|
---|
189 | </tr>
|
---|
190 | </TABLE>
|
---|
191 | </BODY>
|
---|
192 | </HTML>
|
---|
193 | ');
|
---|
194 | }
|
---|
195 |
|
---|
196 | // Zobrazení èíselný seznamu stránek
|
---|
197 | function PagesList($URL,$Page,$TotalCount,$CountPerPage)
|
---|
198 | {
|
---|
199 | $Count = ceil($TotalCount/$CountPerPage);
|
---|
200 | $Around = 10;
|
---|
201 | $Result = '';
|
---|
202 | if($Count>1)
|
---|
203 | {
|
---|
204 | if($Page>0)
|
---|
205 | {
|
---|
206 | $Result.= '<a href="'.$URL.'0"><<</a> ';
|
---|
207 | $Result.= '<a href="'.$URL.($Page-1).'"><</a> ';
|
---|
208 | }
|
---|
209 | $PagesMax = $Count-1;
|
---|
210 | $PagesMin = 0;
|
---|
211 | if($PagesMax>($Page+$Around)) $PagesMax = $Page+$Around;
|
---|
212 | if($PagesMin<($Page-$Around))
|
---|
213 | {
|
---|
214 | $Result.= ' .. ';
|
---|
215 | $PagesMin = $Page-$Around;
|
---|
216 | }
|
---|
217 | for($i=$PagesMin;$i<=$PagesMax;$i++)
|
---|
218 | {
|
---|
219 | if($i==$Page) $Result.= '<strong>';
|
---|
220 | $Result.= '<a href="'.$URL.$i.'">'.($i+1).'</a> ';
|
---|
221 | if($i==$Page) $Result.= '</strong>';
|
---|
222 | }
|
---|
223 | if($PagesMax<($Count-1)) $Result .= ' .. ';
|
---|
224 | if($Page<($Count-1))
|
---|
225 | {
|
---|
226 | $Result.= '<a href="'.$URL.($Page+1).'">></a> ';
|
---|
227 | $Result.= '<a href="'.$URL.($Count-1).'">>></a>';
|
---|
228 | }
|
---|
229 | }
|
---|
230 | return($Result);
|
---|
231 | }
|
---|
232 |
|
---|
233 | ?>
|
---|