-
Notifications
You must be signed in to change notification settings - Fork 0
/
ladder.php
43 lines (42 loc) · 1.06 KB
/
ladder.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
<?php
include('includes/config.php');
include('includes/header.php');
echo "<div class='content'><center>";
echo "<table>";
echo "<tr>
<th>Position</th>
<th>Login</th>
<th>Victoires</th>
<th>Defaites</th>
<th>Ratio</th>
</tr>";
$db = connect();
$i = 1;
$query = $db->query('SELECT * FROM `users` ORDER BY (pwon / (pwon + ploose)) DESC');
while ($data = $query->fetch()) {
if ($i == 1) {
$image = "icon-rocket";
} else if ($i == 2) {
$image = "icon-evil";
} else if ($i == 3) {
$image = "icon-fire";
} else {
$image = "icon-thumbs-up";
}
if ($data['pwon'] + $data['ploose']) {
$ratio = intval(($data['pwon'] / ($data['pwon'] + $data['ploose']) * 100), 100);
} else {
$ratio = 0;
}
echo "<tr>
<td>$i <i class='".$image."'></i></td>
<td><a href='profile.php?id=".$data['id']."'>".$data['login']."</a></td>
<td style='color: green;'>".$data['pwon']."</td>
<td style='color: red'>".$data['ploose']."</td>
<td>".$ratio."%</td>
</tr>";
$i++;
}
echo "</table></center>";
include('includes/footer.php');
?>