source:
branches/posledni/pages/nej-hraci.php
| Last change on this file was 697, checked in by , 16 years ago | |
|---|---|
| File size: 1.1 KB | |
| Line | |
|---|---|
| 1 | <?php |
| 2 | $top = 40; //kolik nejlepších |
| 3 | |
| 4 | function 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 | function getOnline($online) |
| 17 | { |
| 18 | if($online == 1) $status = '<span style="color: green;">Online</span>'; |
| 19 | else $status = '<span style="color: red;">Offline</span>'; |
| 20 | return($status); |
| 21 | } |
| 22 | |
| 23 | $Realm = new Realm($System, $_COOKIE['RealmIndex']); |
| 24 | $db = $Realm->CharactersDatabase; |
| 25 | |
| 26 | $sql = 'SELECT name, totaltime, online FROM characters ORDER BY totaltime DESC LIMIT '.$top; |
| 27 | $result = $db->query($sql); |
| 28 | |
| 29 | $i = 0; |
| 30 | echo('<h3 class="PageTitle">Nejlepších '.$top.' herních časů</h3>'); |
| 31 | |
| 32 | echo('<table class="SimpleTable">'); |
| 33 | while($vypis = $result->fetch_assoc()) |
| 34 | { |
| 35 | $i = $i + 1; |
| 36 | echo('<tr><td>'.$i.')<th>'.$vypis['name'].'</th> |
| 37 | <td>'.getTime($vypis['totaltime']).'</td> |
| 38 | <td>'.getOnline($vypis['online']).'</td></tr>'); |
| 39 | |
| 40 | } |
| 41 | echo('</table>'); |
| 42 | |
| 43 | ?> |
Note:
See TracBrowser
for help on using the repository browser.
![(please configure the [header_logo] section in trac.ini)](/wow/chrome/site/your_project_logo.png)