source: trunk/pages/tophraci.php@ 589

Last change on this file since 589 was 589, checked in by george, 16 years ago
  • Upraveno: Stránka Top hráči poopravena.
  • Přidáno: Datum založení serveru.
File size: 1.1 KB
Line 
1<?php
2$top = 40; //kolik nejlepších
3
4function getTime($total)
5{
6 $dny = (int)($total / 86400);
7 $total = $total - ($dny * 86400);
8 $hodiny = (int)($total / 3600);
9 $total = $total - ($hodiny * 3600);
10 $minuty = (int)($total / 60);
11
12 $cas = $dny.'d '.$hodiny.'h '.$minuty.'m';
13 return($cas);
14}
15
16
17function getOnline($online)
18{
19 if ($online == 1):
20 $status = '<span style="color: green;">Online</span>';
21 else:
22 $status = '<span style="color: red;">Offline</span>';
23 endif;
24
25 return($status);
26}
27
28$db->select_db($Config['Mangos']['DatabaseCharacters']);
29$sql = 'SELECT name, totaltime, online FROM characters ORDER BY totaltime DESC LIMIT '.$top;
30$result = $db->query($sql);
31
32$i = 0;
33echo('<h3 class="PageTitle">Nejlepších '.$top.' herních časů</h3>');
34
35echo('<table class="SimpleTable">');
36while($vypis = $result->fetch_assoc())
37{
38 $i = $i + 1;
39 echo('<tr><td>'.$i.')<th>'.$vypis['name'].'</th>
40 <td>'.getTime($vypis['totaltime']).'</td>
41 <td>'.getOnline($vypis['online']).'</td></tr>');
42
43}
44echo('</table>');
45
46?>
Note: See TracBrowser for help on using the repository browser.