-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
129 lines (118 loc) · 4.34 KB
/
index.php
File metadata and controls
129 lines (118 loc) · 4.34 KB
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
<?
include "header.php";
// Mail Module
// ST's get their own query since they are checking multiple accounts.
if ($config[mail]) {
if ($st == '1') {
if ($unreadlist = $mysqli->prepare("SELECT COUNT(*) FROM mailmsg WHERE mailto IN (SELECT id FROM players WHERE username=?) AND mailread = '0'")) {
$unreadlist->bind_param('s',$username);
$unreadlist->execute();
$unreadlist->bind_result($newmailcount);
print "<div class=entry>";
while ($unreadlist->fetch()) {
print "<p class=title><a href=\"inbox/index.php\">mail module:</a></p>
You have $newmailcount new messages!";
}
print "</div>";
$unreadlist->close();
}
} else {
if ($config[mail]) {
if ($unreadlist = $mysqli->prepare("SELECT COUNT(*) FROM mailmsg WHERE mailto = ? and mailread = '0'")) {
$unreadlist->bind_param('i',$userid);
$unreadlist->execute();
$unreadlist->bind_result($newmailcount);
print "<div class=entry>";
while ($unreadlist->fetch()) {
print "<p class=title><a href=\"inbox/index.php\">mail module:</a></p>
You have $newmailcount new messages!";
}
print "</div>";
$unreadlist->close();
}
}
}
}
// Bank Module
if ($config[bank] || $st == '1') {
if ($st == '1') {
print "<div class=entry>
<p class=title><a href=\"bank/\">bank module:</a></p>";
if ($acctbalance = $mysqli->query("SELECT accountid,playername,SUM(transamt) AS cash FROM bank AS b INNER JOIN players AS p ON b.accountid = p.id WHERE accountid NOT IN (SELECT id FROM players WHERE username='$username') GROUP BY accountid")) {
while ($acctres = $acctbalance->fetch_assoc()) {
if ($acctres['accountid'] == '0') {
$acctres['playername'] = 'Party Loot';
}
print "<li>The current balance of " . $acctres['playername'] . " is " . $acctres['cash'];
}
$acctbalance->close();
} else {
print "Something went wrong";
}
// Gettohack for the party account (players.id='0');
if ($acctbalance = $mysqli->query("SELECT accountid,SUM(transamt) AS cash FROM bank WHERE accountid='0' GROUP BY accountid")) {
while ($acctres = $acctbalance->fetch_assoc()) {
print "<li>The current party loot balance is " . $acctres['cash'];
}
} else {
print "Something went wrong";
}
print "</ul></div>";
} else {
print "<div class=entry>
<p class=title><a href=\"bank/\">bank module:</a></p>";
if ($acctbalance = $mysqli->query("SELECT SUM(transamt) AS cash FROM bank where accountid=$userid")) {
$acctres = $acctbalance->fetch_assoc();
if (!$acctres['cash']) { $acctres['cash'] = "0"; }
print "<li>your current balance is <u>" . $acctres['cash'] . "</u>";
$acctbalance->close();
}
if ($acctdatequery = $mysqli->query("SELECT DATE_ADD(date,INTERVAL 70 YEAR) as date FROM bank WHERE accountid=$userid ORDER BY date DESC LIMIT 1")) {
$acctdate = $acctdatequery->fetch_assoc();
if ($acctdate['date']) { print " as of <u>" . $acctdate['date'] . "</u>"; }
}
$acctdatequery->close();
if ($partybalance = $mysqli->query("SELECT SUM(transamt) AS cash FROM bank where accountid='0'")) {
$partyres = $partybalance->fetch_assoc();
if (!$partyres['cash']) { $partyres['cash'] = "0"; }
print "<li>the current party account balance is <u>" . $partyres['cash'] . "</ul></div>";
$partybalance->close();
}
print "</ul></div>";
}
}
// Job Module
if ($config[job]) {
if ($numactive = $mysqli->query("SELECT jobid FROM job WHERE postdate <= NOW() AND expdate >= NOW() and completed = '0'")) {
print "<div class=entry>
<p class=title><a href=\"job\">job module:</a></p>
you have " . $numactive->num_rows . " job(s) available
</div>";
$numactive->close();
}
}
// Karma Module
print "<div class=entry>
<p class=title><a href=\"karma\">karma module:</a></p>";
if ($st) {
print "<ul><li>Karma Totals<br>\n";
$pcid2un = activeuserid2playername();
foreach ($pcid2un as $userid => $username) {
print "<ul><li>$username => " . gettotalkarma($userid) . "</ul></li><br>\n";
}
}
if (!$st) {
$totalkarma = gettotalkarma($userid);
$compkarma = getcompletedkarma($userid);
$pendingkarma = getpendingkarma($userid);
print "<ul><li>Your lifetime karma pool is $totalkarma<br>
<ul><li>" . abs($pendingkarma) . " are in pending transactions
<li>" . abs($compkarma) . " are spent in completed transactions
<li> You have " . ($totalkarma + $compkarma + $pendingkarma) . " available to put spending requests for
</ul></li>";
}
print "</div>";
// New Shop Stuff Module
// Inventory Module
include "footer.php";
?>