-
Notifications
You must be signed in to change notification settings - Fork 8
/
header.php
227 lines (218 loc) · 7.28 KB
/
header.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
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
<?php
declare(strict_types=1);
/**
* MCCodes Version 2.0.5b
* Copyright (C) 2005-2012 Dabomstew
* All rights reserved.
*
* Redistribution of this code in any form is prohibited, except in
* the specific cases set out in the MCCodes Customer License.
*
* This code license may be used to run one (1) game.
* A game is defined as the set of users and other game database data,
* so you are permitted to create alternative clients for your game.
*
* If you did not obtain this code from MCCodes.com, you are in all likelihood
* using it illegally. Please contact MCCodes to discuss licensing options
* in this case.
*
* File: header.php
* Signature: 52c201ce2e8c549ae70d2936473022f0
* Date: Fri, 20 Apr 12 08:50:30 +0000
*/
class headers
{
/**
* @return void
*/
public function startheaders(): void
{
global $set;
echo <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/game.css" type="text/css" rel="stylesheet" />
<title>{$set['game_name']}</title>
</head>
<body>
<center>
<table width="970" border="0" cellpadding="0" cellspacing="0" class="table2">
<tr>
<td class="lgrad"></td>
<td class="center">
EOF;
}
/**
* @param $ir
* @param $lv
* @param $fm
* @param $cm
* @param int $dosessh
* @return void
*/
public function userdata($ir, $lv, $fm, $cm, int $dosessh = 1): void
{
global $db, $userid, $set;
$IP = $db->escape($_SERVER['REMOTE_ADDR']);
$db->query(
"UPDATE `users`
SET `laston` = {$_SERVER['REQUEST_TIME']}, `lastip` = '$IP'
WHERE `userid` = $userid");
if (!$ir['email']) {
global $domain;
die(
"<body>Your account may be broken. Please mail help@{$domain} stating your username and player ID.");
}
if (!isset($_SESSION['attacking'])) {
$_SESSION['attacking'] = 0;
}
if ($dosessh && ($_SESSION['attacking'] || $ir['attacking'])) {
echo 'You lost all your EXP for running from the fight.';
$db->query(
"UPDATE `users`
SET `exp` = 0, `attacking` = 0
WHERE `userid` = $userid");
$_SESSION['attacking'] = 0;
}
$enperc = min((int)($ir['energy'] / $ir['maxenergy'] * 100), 100);
$wiperc = min((int)($ir['will'] / $ir['maxwill'] * 100), 100);
$experc = min((int)($ir['exp'] / $ir['exp_needed'] * 100), 100);
$brperc = min((int)($ir['brave'] / $ir['maxbrave'] * 100), 100);
$hpperc = min((int)($ir['hp'] / $ir['maxhp'] * 100), 100);
$enopp = 100 - $enperc;
$wiopp = 100 - $wiperc;
$exopp = 100 - $experc;
$bropp = 100 - $brperc;
$hpopp = 100 - $hpperc;
$d = '';
$u = $ir['username'];
if ($ir['donatordays']) {
$u = "<span style='color: red;'>{$ir['username']}</span>";
$d =
"<img src='donator.gif'
alt='Donator: {$ir['donatordays']} Days Left'
title='Donator: {$ir['donatordays']} Days Left' />";
}
$gn = '';
$bgcolor = 'FFFFFF';
print
<<<OUT
<img src="title.jpg" alt="Mccodes Version 2" /><br />
<!-- Begin Main Content -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" bgcolor="#$bgcolor" valign="top">
<!-- Side Panel -->
<b>Name:</b> $gn{$u} [{$ir['userid']}] $d<br />
<b>Money:</b> {$fm}<br />
<b>Level:</b> {$ir['level']}<br />
<b>Crystals:</b> {$ir['crystals']}<br />
[<a href='logout.php'>Emergency Logout</a>]
<hr />
<b>Energy:</b> {$enperc}%<br />
<img src='greenbar.png' width='$enperc' height='10' /><img src='redbar.png' width='$enopp' height='10' /><br />
<b>Will:</b> {$wiperc}%<br />
<img src='bluebar.png' width='$wiperc' height='10' /><img src='redbar.png' width='$wiopp' height='10' /><br />
<b>Brave:</b> {$ir['brave']}/{$ir['maxbrave']}<br />
<img src='yellowbar.png' width='$brperc' height='10' /><img src='redbar.png' width='$bropp' height='10' /><br />
<b>EXP:</b> {$experc}%<br />
<img src='bluebar.png' width='$experc' height='10' /><img src='redbar.png' width='$exopp' height='10' /><br />
<b>Health:</b> {$hpperc}%<br />
<img src='greenbar.png' width='$hpperc' height='10' /><img src='redbar.png' width='$hpopp' height='10' /><br /><hr />
<!-- Links -->
OUT;
if ($ir['fedjail'] > 0) {
$q =
$db->query(
"SELECT *
FROM `fedjail`
WHERE `fed_userid` = $userid");
$r = $db->fetch_row($q);
die(
"<span style='font-weight: bold; color:red;'>
You have been put in the {$set['game_name']} Federal Jail
for {$r['fed_days']} day(s).<br />
Reason: {$r['fed_reason']}
</span></body></html>");
}
if (file_exists('ipbans/' . $IP)) {
die(
"<span style='font-weight: bold; color:red;'>
Your IP has been banned from {$set['game_name']},
there is no way around this.
</span></body></html>");
}
}
/**
* @return void
* @noinspection SpellCheckingInspection
*/
public function menuarea(): void
{
define('JDSF45TJI', true);
include 'mainmenu.php';
global $ir, $set;
$bgcolor = 'FFFFFF';
print
'</td><td width="2" class="linegrad" bgcolor="#' . $bgcolor
. '"> </td><td width="80%" bgcolor="#'
. $bgcolor . '" valign="top"><br /><center>';
if ($ir['hospital']) {
echo "<b>NB:</b> You are currently in hospital for {$ir['hospital']} minutes.<br />";
}
if ($ir['jail']) {
echo "<b>NB:</b> You are currently in jail for {$ir['jail']} minutes.<br />";
}
echo "<a href='donator.php'><b>Donate to {$set['game_name']} now for game benefits!</b></a><br />";
}
/**
* @return void
* @noinspection SpellCheckingInspection
*/
public function smenuarea(): void
{
define('JDSF45TJI', true);
include 'smenu.php';
$bgcolor = 'FFFFFF';
print
'</td><td width="2" class="linegrad" bgcolor="#' . $bgcolor
. '"> </td><td width="80%" bgcolor="#'
. $bgcolor . '" valign="top"><center>';
}
/**
* @return void
*/
public function endpage(): void
{
global $db;
$query_extra = '';
if (isset($_GET['mysqldebug']) && check_access('administrator')) {
$query_extra = '<br />' . implode('<br />', $db->queries);
}
print
<<<OUT
</center>
</td>
</tr>
</table></td>
<td class="rgrad"></td>
</tr>
<tr>
<td colspan="3">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="dgradl"> </td>
<td class="dgrad"> </td>
<td class="dgradr"> </td>
</tr>
</table>
</td>
</tr>
</table>
{$db->num_queries} queries{$query_extra}</body>
</html>
OUT;
}
}