/
gamelog.php
executable file
·71 lines (60 loc) · 1.95 KB
/
gamelog.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
// translator ready
// addnews ready
// mail ready
// Written by Christian Rutsch
require_once("common.php");
require_once("lib/http.php");
check_su_access(SU_EDIT_CONFIG);
tlschema("gamelog");
page_header("Game Log");
addnav("Navigation");
require_once("lib/superusernav.php");
superusernav();
$category = httpget('cat');
if ($category > "") {
$cat = "&cat=$category";
$sqlcat = "WHERE ".db_prefix("gamelog").".category = '$category'";
} else {
$cat='';
$sqlcat='';
}
$sql = "SELECT count(logid) AS c FROM ".db_prefix("gamelog")." $sqlcat";
$result = db_query($sql);
$row = db_fetch_assoc($result);
$max = $row['c'];
$start = (int)httpget('start');
$sql = "SELECT ".db_prefix("gamelog").".*, ".db_prefix("accounts").".name AS name FROM ".db_prefix("gamelog")." LEFT JOIN ".db_prefix("accounts")." ON ".db_prefix("gamelog").".who = ".db_prefix("accounts").".acctid $sqlcat LIMIT $start,500";
$next = $start+500;
$prev = $start-500;
addnav("Operations");
addnav("Refresh", "gamelog.php?start=$start$cat");
if ($category > "") addnav("View all", "gamelog.php");
addnav("Game Log");
if ($next < $max) {
addnav("Next page","gamelog.php?start=$next$cat");
}
if ($start > 0) {
addnav("Previous page", "gamelog.php?start=$prev$cat");
}
$result = db_query($sql);
$odate = "";
$categories = array();
$i=0;
while ($row = db_fetch_assoc($result)) {
$dom = date("D, M d",strtotime($row['date']));
if ($odate != $dom){
output_notl("`n`b`@%s`0`b`n", $dom);
$odate = $dom;
}
$time = date("H:i:s", strtotime($row['date']))." (".reltime(strtotime($row['date'])).")";
output_notl("`7(%s) %s `7(`&%s`7)", $row['category'], $row['message'], $row['name']);
if (!isset($categories[$row['category']]) && $category == "") {
addnav("Operations");
addnav(array("View by `i%s`i", $row['category']), "gamelog.php?cat=".$row['category']);
$categories[$row['category']] = 1;
}
output_notl("`n");
}
page_footer();
?>