-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstats.php
58 lines (54 loc) · 2.18 KB
/
stats.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
<?php
session_start();
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Mega Hovertank Wars - Statistics Repository</title>
<link rel="stylesheet" href="main.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#stats-search').submit(function() {
var params = '{"uid":"' + $('#uid').val() + '","uip":"' + $('#uip').val() + '","sort":"' + $('#sort').val() + '"}';
$.getJSON('search.php', {query: params}, function(data) {
if(data.key < 0) $('#results').html('Error ' + data.key + '!');
else {
$('#results').html('<table id="rtable"><thead><tr><td>User ID</td><td>User IP</td><td>Kills</td><td>Deaths</td><td>K/D Ratio</td><td>Games Played</td></tr></thead></table>');
$.each(data.result, function(i, item) {
$('#rtable').append('<tr><td>' + item.uid + '</td><td>' + item.uip + '</td><td>' + item.kills + '</td><td>' + item.deaths + '</td><td>' + item.kills / item.deaths + '</td><td>' + item.games + '</td></tr>');
});
}
});
return false;
});
});
</script>
</head>
<body>
<div id="content">
<h1>Browse Statistics</h1>
<form id="stats-search" name="stats-search">
<label for="uid">User ID:</label><input type="text" id="uid" name="uid" />
<label for="uip">User IP:</label><input type="text" id="uip" name="uip" />
<label for="sort">Sort by:</label>
<select id="sort" name="sort">
<option value="uid0">User ID Ascending</option>
<option value="uid1">User ID Descending</option>
<option value="uip0">Uiser IP Ascending</option>
<option value="uip1">Uiser IP Descending</option>
<option value="k0">Kills Ascending</option>
<option value="k1">Kills Descending</option>
<option value="d0">Deaths Ascending</option>
<option value="d1">Deaths Descending</option>
<option value="g0">Games Played Ascending</option>
<option value="g1">Games Played Descending</option>
</select>
<input type="submit" value="Search!" id="search" name="search" />
<br /><a href="index.php" title="Back to Home">Back to Home</a>
</form>
<div id="results"></div>
<div id="footer">© 2010 Mega Hovertank Wars</div>
</div>
</body>
</html>