-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkillers.php
117 lines (111 loc) · 3.63 KB
/
killers.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php require_once 'engine/init.php'; include 'layout/overall/header_myacc_no_container_fc.php';
if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') {
$cache = new Cache('engine/cache/killers');
if ($cache->hasExpired()) {
$killers = fetchMurders();
$cache->setContent($killers);
$cache->save();
} else {
$killers = $cache->load();
}
$cache = new Cache('engine/cache/victims');
if ($cache->hasExpired()) {
$victims = fetchLoosers();
$cache->setContent($victims);
$cache->save();
} else {
$victims = $cache->load();
}
$cache = new Cache('engine/cache/lastkillers');
if ($cache->hasExpired()) {
$latests = mysql_select_multi("SELECT `p`.`name` AS `victim`, `d`.`killed_by` as `killed_by`, `d`.`time` as `time` FROM `player_deaths` as `d` INNER JOIN `players` as `p` ON d.player_id = p.id WHERE d.`is_player`='1' ORDER BY `time` DESC LIMIT 20;");
if ($latests !== false) {
$cache->setContent($latests);
$cache->save();
}
} else {
$latests = $cache->load();
}
if ($killers) {
?>
<h1>Biggest Murders</h1>
<table id="killersTable" class="table table-striped" style="color:white">
<tr class="yellow">
<th>Name</th>
<th>Kills</th>
</tr>
<?php foreach ($killers as $killer) {
echo '<tr>';
echo "<td width='70%'><a href='characterprofile.php?name=". $killer['killed_by'] ."'>". $killer['killed_by'] ."</a></td>";
echo "<td width='30%'>". $killer['kills'] ."</td>";
echo '</tr>';
} ?>
</table>
<?php
} else echo '<h1>Biggest Murders</h1> <br>No player kills exist.<br></br>';
if ($victims) {
?>
<h1>Biggest Victims</h1>
<table id="victimsTable" class="table table-striped" style="color:white">
<tr class="yellow">
<th>Name</th>
<th>Deaths</th>
</tr>
<?php foreach ($victims as $victim) {
echo '<tr>';
echo "<td width='70%'><a href='characterprofile.php?name=". $victim['name'] ."'>". $victim['name'] ."</a></td>";
echo "<td width='30%'>". $victim['Deaths'] ."</td>";
echo '</tr>';
} ?>
</table>
<?php
} else echo '<h1>Biggest Victims</h1> <br>No player kills exist.<br></br>';
if ($latests) {
?>
<h1>Latest kills</h1>
<table id="killersTable" class="table table-striped" style="color:white">
<tr class="yellow">
<th>Killer</th>
<th>Time</th>
<th>Victim</th>
</tr>
<?php foreach ($latests as $last) {
echo '<tr>';
echo "<td width='35%'><a href='characterprofile.php?name=". $last['killed_by'] ."'>". $last['killed_by'] ."</a></td>";
echo "<td width='30%'>". getClock($last['time'], true) ."</td>";
echo "<td width='35%'><a href='characterprofile.php?name=". $last['victim'] ."'>". $last['victim'] ."</a></td>";
echo '</tr>';
} ?>
</table>
<?php
} else echo '<h1>Latest kills</h1><br>No player kills exist.<br></br>';
} else if ($config['ServerEngine'] == 'TFS_03') {
$cache = new Cache('engine/cache/killers');
if ($cache->hasExpired()) {
$deaths = fetchLatestDeaths_03(30, true);
$cache->setContent($deaths);
$cache->save();
} else {
$deaths = $cache->load();
}
if ($deaths && !empty($deaths)) {
?>
<h1>Latest Killers</h1>
<table id="deathsTable" class="table table-striped">
<tr class="yellow">
<th>Killer</th>
<th>Time</th>
<th>Victim</th>
</tr>
<?php foreach ($deaths as $death) {
echo '<tr>';
echo "<td><a href='characterprofile.php?name=". $death['killed_by'] ."'>". $death['killed_by'] ."</a></td>";
echo "<td>". getClock($death['time'], true) ."</td>";
echo "<td>At level ". $death['level'] .": <a href='characterprofile.php?name=". $death['victim'] ."'>". $death['victim'] ."</a></td>";
echo '</tr>';
} ?>
</table>
<?php
} else echo 'No player deaths exist.';
}
include 'layout/overall/footer_myaccount.php'; ?>