forked from PlayerNguyen/OptEco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_top.php
71 lines (64 loc) · 2.12 KB
/
example_top.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
* example_top.php
*
* Code in OptEcoWebAPI Project
*/
const DISPLAY_MONEY = true;
/**
* Require Libraries
*/
require_once "api/OptEcoAPI.php";
require_once "api/PlayerAPI.php";
?>
<!doctype html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<meta name="theme-color" content="">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Top Riches Player</title>
<link rel="stylesheet" href="css/stylesheet.css">
</head>
<body>
<div class="header">
<h1 class="header-title">< Top riches ></h1>
<h3 class="header-description">Top riches people in server</h3>
</div>
<div class="container">
<h2 id="top5"><a href="#top5"># Top 5</a></h2>
<table class="top-player-donate w-100">
<?php
$api = new OptEcoAPI(new OptEcoMySQL());
$players = $api->getAccounts("`player`, `balance`", "ORDER BY `balance` DESC LIMIT 5");
?>
<tr>
<th>#</th>
<th>Avatar</th>
<th>Player</th>
<?php if (DISPLAY_MONEY) echo "<th>Money</th>"; ?>
</tr>
<?php
if (sizeof($players) < 1) {
echo "<tr><td></td><td></td><td><i>Nothing in this list</i></td><td></td></tr>";
} else {
$counter = 0;
foreach ($players as $player) {
$counter ++;
echo "<tr>";
echo "<td class='center'>{$counter}</td>";
echo "<td class='center'><img src='https://minotar.net/avatar/{$player['player']}/20' alt='face'></td>";
echo "<td>{$player['player']}</td>";
if (DISPLAY_MONEY) echo "<td class='center'>{$player['balance']}</td>";
echo "</tr>";
}
} ?>
</table>
</div>
</body>
</html>