topplayers.php

main 32 lines · 807 bytes Raw
Alex Alex Commit Initial commit 01/10/2026 09:20
1<div class="well widget">
2 <div class="header">
3 <?= t('widget.topplayers.title') ?>
4 </div>
5 <div class="body">
6 <table>
7 <?php
8 $cache = new Cache('engine/cache/topPlayer');
9 if ($cache->hasExpired()) {
10 $players = db()->fetchAll("
11 SELECT `name`, `level`, `experience`
12 FROM `players` WHERE `group_id` < ?
13 ORDER BY `level` DESC, `experience` DESC LIMIT 5;
14 ", [$config['highscore']['ignoreGroupId']]);
15
16 $cache->setContent($players);
17 $cache->save();
18 } else {
19 $players = $cache->load();
20 }
21
22 if ($players) {
23 foreach($players as $count => $player) {
24 $nr = $count+1;
25 echo "<tr><td>{$nr}</td><td><a href='characterprofile.php?name={$player['name']}'>{$player['name']}</a> ({$player['level']}).</td></tr>";
26 }
27 }
28 ?>
29 </table>
30 </div>
31</div>
32
Top