-
Notifications
You must be signed in to change notification settings - Fork 0
/
dump.php
84 lines (74 loc) · 1.99 KB
/
dump.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
<?php
include("constants.php");
include("common.php");
include("query.php");
include("objects.php");
db_open($database);
$zurich = db_retrieve("Zurich", "objects");
$player = $_COOKIE['player'];
?>
<html>
<head>
<title>Dump of ZWG3</title>
<link rel="stylesheet" href="zwg.css">
</head>
<body>
<?php
function print_vars($obj) {
$arr = get_object_vars($obj);
if ($arr) {
while (list($prop, $val) = each($arr)) {
$type = gettype($val);
if ($type == "array") {
echo "$prop = $val<BR>\n<blockquote>\n";
if ($obj->$prop)
foreach ($obj->$prop as $k => $o) {
echo "[$k] <BR>";
print_vars($o);
echo "<br>\n";
}
echo "\n</blockquote>\n";
}
else { /* $type != array */
echo "$prop = $val";
if ($val > 1000000000) {
$time = date("g:i a D, d M", $val);
echo " ($time)";
}
echo "<BR>\n";
}
}
}
else {echo "$obj";}
}
function print_log() {
$query = new Query("SELECT id, name, action,
to_char(time, 'HH24:MI on DD Mon') as timestring
FROM log
ORDER BY id DESC");
echo "<table width=\"90%\" border=0 cellspacing=2 cellpadding=0>";
$query->last_rec();
while($query->prev_rec()) {
$log_time = $query->field('timestring');
$log_id = $query->field('id');
$log_name = $query->field('name');
$log_action = $query->field('action');
echo "<tr><td colspan=3 valign=top bgcolor=white>
<span class=smalltext>$log_time</span></td>
<td width=76 valign=top bgcolor=white>
<span class=smalltext>";
echo " $log_name ";
echo "</span></td><td valign=top bgcolor=white>
<span class=smalltext>$log_action</span></td>\n</tr>\n";
}
echo "</table>\n";
}
echo "<H3>Dump of the ZWG database: $database at " . date("g:ia, l j F Y") . "</H3>";
echo "Player from cookie: [$player]<P>";
print_vars ($zurich);
echo "<h2>The complete action log</h2>";
print_log();
?>
<center><h2>End</h2></center>
</body>
</html>