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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
<?php
$map = mysql_real_escape_string($_GET[map]);
$bugmap = mysql_real_escape_string($_GET[map]);
$realmap = $bugmap.".unr";
$map_matches = small_query("SELECT COUNT(id) as matchcount, SUM(t0score+t1score+t2score+t3score) AS gamescore,
SUM(gametime) AS gametime, SUM(kills) AS kills, SUM(deaths) AS deaths, SUM(suicides) AS suicides, SUM(teamkills) AS teamkills FROM uts_match WHERE mapfile = '$realmap' OR mapfile = '$bugmap'");
$map_last = small_query("SELECT time FROM uts_match WHERE mapfile = '$realmap' OR mapfile = '$bugmap' ORDER BY time DESC LIMIT 0,1");
$map_tottime = GetMinutes($map_matches[gametime]);
$map_lastmatch = mdate($map_last[time]);
if($map_matches[gametime]<= 0) {
echo "map not found";
} else {
// Map pic code
$mappic = getMapImageName($map);
echo '
<table class="zebra box" border="0" cellpadding="0" cellspacing="0" width="700">
<tbody>
<tr>
<th class="heading" align="center" colspan="4">Statistics for '.htmlentities($map).'</th>
</tr>
<tr>
<th colspan="4" class="mapheader">
<img border="0" alt="'.$map.'" src="'.$mappic.'" width=698>
</th>
</tr>
<tr>
<th align="center">Matches</th>
<td align="center">'.$map_matches[matchcount].'</td>
</tr>
<tr>
<th align="center">Total Time</th>
<td align="center">'.$map_tottime.' minutes</td>
</tr>';
// Show some gametype specific stuff
if ((strtolower(substr($map, 0, 7)) == "ctf-bt-") or (strtolower(substr($map, 0, 3)) == "bt-")) {
// Bunny Track
$record = small_query("SELECT pi.id, pi.name AS name, pi.country, e.col3 AS time, e.col4 AS date FROM uts_events AS e, uts_pinfo AS pi, uts_player AS p, uts_match AS m WHERE m.id = e.matchid AND m.id = p.matchid AND p.playerid = e.playerid AND pi.id = p.pid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap') AND e.col1 = 'btcap' GROUP BY pi.id ORDER BY (0 + e.col3) ASC, e.col4 ASC LIMIT 0,1");
if (!empty($record['time'])) {
echo '
<tr>
<th align="center">Fastest Capture</th>
<td align="center"><a href="?p=pinfo&pid='.$record[id].'">'.FormatPlayerName($record['country'], $record['id'], $record['name']).'</a><br>' . btcaptime($record['time']) . ' minutes<BR>'.gmdate('d-m-Y h:i a', $record['date']).'</td>
</tr>';
}
else {
echo '
<tr>
<th align="center">Fastest Capture</th>
<td align="center">No record set!</td>
</tr>';
}
echo '
<tr>
<th align="center">Total Flags Captured</th>
<td align="center">'.$map_matches[gamescore].'</td>
</tr>
<tr>
<th align="center">Total Suicides</th>
<td align="center">'.$map_matches[suicides].'</td>
</tr>';
}
else if (strtolower(substr($map, 0, 4)) == "ctf-") {
// Capture the Flag
$totals = small_query("SELECT SUM(p.flag_taken) as flag_taken, SUM(p.flag_return) AS flag_return, SUM(p.flag_cover) AS flag_cover FROM uts_player AS p, uts_match AS m WHERE m.id = p.matchid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap')");
echo '
<tr>
<th align="center">Total Flags Captured</th>
<td align="center">'.$map_matches[gamescore].'</td>
</tr>
<tr>
<th align="center">Total Flags Taken</th>
<td align="center">'.$totals['flag_taken'].'</td>
</tr>
<tr>
<th align="center">Total Covers</th>
<td align="center">'.$totals['flag_cover'].'</td>
</tr>
<tr>
<th align="center">Total Flags Returned</th>
<td align="center">'.$totals['flag_return'].'</td>
</tr>
<tr>
<th align="center">Total Kills</th>
<td align="center">'.$map_matches[kills].'</td>
</tr>
<tr>
<th align="center">Total Suicides</th>
<td align="center">'.$map_matches[suicides].'</td>
</tr>';
}
else if (strtolower(substr($map, 0, 3)) == "as-") {
// Assault
$totals = small_query("SELECT SUM(p.ass_obj) as ass_obj FROM uts_player AS p, uts_match AS m WHERE m.id = p.matchid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap')");
echo '
<tr>
<th align="center">Total Objectives Achieved</th>
<td align="center">'.$totals[ass_obj].'</td>
</tr>
<tr>
<th align="center">Total Kills</th>
<td align="center">'.$map_matches[kills].'</td>
</tr>
<tr>
<th align="center">Total Suicides</th>
<td align="center">'.$map_matches[suicides].'</td>
</tr>';
}
else if (strtolower(substr($map, 0, 3)) == "jb-") {
// Assault
$totals = small_query("SELECT SUM(p.ass_obj) as ass_obj FROM uts_player AS p, uts_match AS m WHERE m.id = p.matchid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap')");
echo '
<tr>
<th align="center">Team Releases</th>
<td align="center">'.$totals[ass_obj].'</td>
</tr>
<tr>
<th align="center">Total Kills</th>
<td align="center">'.$map_matches[kills].'</td>
</tr>
<tr>
<th align="center">Total Suicides</th>
<td align="center">'.$map_matches[suicides].'</td>
</tr>';
}
else if (strtolower(substr($map, 0, 4)) == "dom-") {
// Assault
$totals = small_query("SELECT SUM(p.dom_cp) as dom_cp FROM uts_player AS p, uts_match AS m WHERE m.id = p.matchid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap')");
echo '
<tr>
<th align="center">Total Control Points Captured</th>
<td align="center">'.$totals['dom_cp'].'</td>
</tr>
<tr>
<th align="center">Total Kills</th>
<td align="center">'.$map_matches[kills].'</td>
</tr>
<tr>
<th align="center">Total Suicides</th>
<td align="center">'.$map_matches[suicides].'</td>
</tr>';
}
else {
echo '
<tr>
<th align="center">Total Score</th>
<td align="center">'.$map_matches[gamescore].'</td>
</tr>
<tr>
<th align="center">Total Kills</th>
<td align="center">'.$map_matches[kills].'</td>
</tr>
<tr>
<th align="center">Total Teamkills</th>
<td align="center">'.$map_matches[teamkills].'</td>
</tr>
<tr>
<th align="center">Total Suicides</th>
<td align="center">'.$map_matches[suicides].'</td>
</tr>';
}
echo '
<tr>
<th align="center">Last Match</th>
<td align="center">'.$map_lastmatch.'</td>
</tr>
</tbody></table>
<br>';
// Show a list of recent matches
$mcount = small_count("SELECT id FROM uts_match WHERE mapfile = '$realmap' OR mapfile = '$bugmap' GROUP BY id");
$ecount = $mcount/25;
$ecount2 = number_format($ecount, 0, '.', '');
if ($ecount > $ecount2) {
$ecount2 = $ecount2+1;
}
$fpage = 0;
if ($ecount < 1) { $lpage = 0; }
else { $lpage = $ecount2-1; }
$cpage = preg_replace('/\D/', '', $_GET["page"]);
$qpage = $cpage*25;
if ($cpage == "") { $cpage = "0"; }
$tfpage = $cpage+1;
$tlpage = $lpage+1;
$ppage = $cpage-1;
$ppageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&page=$ppage\">[Previous]</a>";
if ($ppage < "0") { $ppageurl = "[Previous]"; }
$npage = $cpage+1;
$npageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&page=$npage\">[Next]</a>";
if ($npage >= "$ecount") { $npageurl = "[Next]"; }
$fpageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&page=$fpage\">[First]</a>";
if ($cpage == "0") { $fpageurl = "[First]"; }
$lpageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&page=$lpage\">[Last]</a>";
if ($cpage == "$lpage") { $lpageurl = "[Last]"; }
// list recent matches
echo '
<div class="pages">Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</div>
<table class="zebra box" border="0" cellpadding="0" cellspacing="0" width=700>
<tbody>
<tr>
<th class="heading" colspan="5" align="center">Recent Matches</th>
</tr>
<tr>
<th class="smheading" align="center" width="250">Date</th>
<th class="smheading" align="center" width="100">Match Type</th>
<th class="smheading" align="center">Player Count</th>
<th class="smheading" align="center" width="100">Time</th>
</tr>';
$sql_maps = "SELECT m.id, m.time, g.name AS gamename, m.gametime
FROM uts_match AS m, uts_games AS g WHERE (m.mapfile = '$realmap' OR m.mapfile = '$bugmap') AND m.gid = g.id ORDER BY time DESC LIMIT $qpage,25";
$q_maps = mysql_query($sql_maps) or die(mysql_error());
while ($r_maps = mysql_fetch_array($q_maps)) {
$r_mapfile = un_ut($r_maps[mapfile]);
$r_matchtime = mdate($r_maps[time]);
$r_gametime = GetMinutes($r_maps[gametime]);
$map_pcount = small_count("SELECT id FROM uts_player WHERE matchid = $r_maps[id]");
echo '
<tr class="clickableRow" href="./?p=match&mid='.$r_maps[id].'">
<td align="center"><a href="./?p=match&mid='.$r_maps[id].'">'.$r_matchtime.'</a></td>
<td align="center">'.$r_maps[gamename].'</td>
<td align="center">'.$map_pcount.'</td>
<td align="center">'.$r_gametime.'</td>
</tr>';
}
echo '
</tbody>
</table>
<div class="pages">Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</div>';
// Do graph stuff
$bgwhere = "(mapfile = '$realmap' or mapfile = '$bugmap')";
include("pages/graph_mbreakdown.php");
// Show a list of BT records
if ((strtolower(substr($map, 0, 7)) == "ctf-bt-") or (strtolower(substr($map, 0, 3)) == "bt-")) {
$mcount = small_count("SELECT pi.id FROM uts_events AS e, uts_pinfo AS pi, uts_player AS p, uts_match AS m WHERE m.id = e.matchid AND m.id = p.matchid AND p.playerid = e.playerid AND pi.id = p.pid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap') GROUP BY pi.id");
$ecount = $mcount/25;
$ecount2 = number_format($ecount, 0, '.', '');
if ($ecount > $ecount2) {
$ecount2 = $ecount2+1;
}
$fpage = 0;
if ($ecount < 1) { $lpage = 0; }
else { $lpage = $ecount2-1; }
$cpage = preg_replace('/\D/', '', $_GET["rpage"]);
$qpage = $cpage*25;
if ($cpage == "") { $cpage = "0"; }
$tfpage = $cpage+1;
$tlpage = $lpage+1;
$ppage = $cpage-1;
$ppageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&rpage=$ppage\">[Previous]</a>";
if ($ppage < "0") { $ppageurl = "[Previous]"; }
$npage = $cpage+1;
$npageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&rpage=$npage\">[Next]</a>";
if ($npage >= "$ecount") { $npageurl = "[Next]"; }
$fpageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&rpage=$fpage\">[First]</a>";
if ($cpage == "0") { $fpageurl = "[First]"; }
$lpageurl = "<a class=\"pages\" href=\"./?p=minfo&map=".htmlentities($map)."&rpage=$lpage\">[Last]</a>";
if ($cpage == "$lpage") { $lpageurl = "[Last]"; }
$sql_btrecords = "SELECT pi.id, pi.name AS name, pi.country, e.col3 AS time, e.col4 AS date FROM uts_events AS e, uts_pinfo AS pi, uts_player AS p, uts_match AS m WHERE m.id = e.matchid AND m.id = p.matchid AND p.playerid = e.playerid AND pi.id = p.pid AND (m.mapfile = '$realmap' OR m.mapfile = '$bugmap') AND e.col1 = 'btcap' GROUP BY pi.id ORDER BY (0 + e.col3) ASC, e.col4 ASC LIMIT $qpage,25";
$q_btrecords = mysql_query($sql_btrecords) or die (mysql_error());
if (mysql_num_rows($q_btrecords) > 0) {
echo '
<div class="pages">Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</div>
<table class="zebra box" border="0" cellpadding="0" cellspacing="0" width="700">
<tbody>
<tr>
<th class="heading" colspan="4" align="center">Fastest captures</th>
</tr>
<tr>
<th class="smheading" align="center" width="40">N°</th>
<th class="smheading" align="center" width="200">Name</th>
<th class="smheading" align="center" width="60">Time</th>
<th class="smheading" align="center" width="180">Date</th>
</tr>';
$i = $qpage;
$lasttime = -1;
while ($r_btrecords = mysql_fetch_array($q_btrecords)) {
$i++;
$class = ($i%2) ? 'grey' : 'grey2';
echo '
<tr><td class = "'.$class.'" align = "right">'.($lasttime == $r_btrecords['time'] ? '' : $i).' </td>
<td class="'.$class.'" align="center"><a href="?p=pinfo&pid='.$r_btrecords[id].'">', FormatPlayerName($r_btrecords['country'], $r_btrecords['id'], $r_btrecords['name']), '</a></td>
<td class="'.$class.'" align="center">', btcaptime($r_btrecords['time']), '</td>
<td class="'.$class.'" align="center">', gmdate('d-m-Y h:i a', $r_btrecords['date']), '</td></tr>';
$lasttime = $r_btrecords['time'];
}
echo '</tbody>
</table>
<div class="pages">Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</div><br>';
}
}
}
?>
|