-
Notifications
You must be signed in to change notification settings - Fork 0
/
clientdetails.php
486 lines (423 loc) · 14.3 KB
/
clientdetails.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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
<?php
$page = "clientdetails";
$page_title = "Client Details";
$auth_name = 'clients';
$b3_conn = true; // this page needs to connect to the B3 database
$pagination = false; // this page requires the pagination part of the footer
require 'inc.php';
## Do Stuff ##
if($_GET['id'])
$cid = $_GET['id'];
if(!isID($cid)) :
set_error('The client id that you have supplied is invalid. Please supply a valid client id.');
send('clients.php');
endif;
if($cid == '') {
set_error('No user specified, please select one');
send('clients.php');
}
## Get Client information ##
$query = "SELECT c.ip, c.connections, c.guid, c.name, c.mask_level, c.greeting, c.time_add, c.time_edit, c.group_bits, g.name
FROM clients c LEFT JOIN groups g ON c.group_bits = g.id WHERE c.id = ? LIMIT 1";
$stmt = $db->mysql->prepare($query) or die('Database Error '. $db->mysql->error);
$stmt->bind_param('i', $cid);
$stmt->execute();
$stmt->bind_result($ip, $connections, $guid, $name, $mask_level, $greeting, $time_add, $time_edit, $group_bits, $user_group);
$stmt->fetch();
$stmt->close();
## Require Header ##
$page_title .= ' '.$name; // add the clinets name to the end of the title
require 'inc/header.php';
?>
<table class="cd-table">
<caption><img src="images/cd-page-icon.png" width="32" height="32" alt="" /><?php echo $name; ?><small>Everything B3 knows about <?php echo $name; ?></small></caption>
<tbody>
<tr>
<th>Name</th>
<td><?php echo tableClean($name); ?></td>
<th>@id</th>
<td><?php echo $cid; ?></td>
</tr>
<tr>
<th>Level</th>
<td><?php
if($user_group == NULL)
echo 'Un-registered';
else
echo $user_group;
?>
</td>
<th>Connections</th>
<td><?php echo $connections; ?></td>
</tr>
<tr>
<th>GUID</th>
<td>
<?php echo guidLink($mem, $config['game']['game'], $guid); ?>
</td>
<th>IP Address</th>
<td>
<?php
$ip = tableClean($ip);
if($mem->reqLevel('view_ip')) :
if ($ip != "") { ?>
<a href="clients.php?s=<?php echo $ip; ?>&t=ip" title="Search for other users with this IP adreess"><?php echo $ip; ?></a>
<a href="http://whois.domaintools.com/<?php echo $ip; ?>" title="Whois IP Search"><img src="images/id_card.png" width="16" height="16" alt="W" /></a>
<a href="http://www.geoiptool.com/en/?IP=<?php echo $ip; ?>" title="Show Location of IP origin on map"><img src="images/globe.png" width="16" height="16" alt="L" /></a>
<?php
} else {
echo "(No IP address available)";
}
else:
echo '(You do not have access to see the IP address)';
endif; // if current user is allowed to see the player's IP address
?>
</td>
</tr>
<tr>
<th>First Seen</th>
<td><?php echo date($tformat, $time_add); ?></td>
<th>Last Seen</th>
<td><?php echo date($tformat, $time_edit); ?></td>
</tr>
</tbody>
</table>
<?php
## Plugins Client Bio Area ##
if(!$no_plugins_active)
$plugins->displayCDBio();
##############################
?>
<!-- Start Echelon Actions Panel -->
<div id="actions">
<ul class="cd-tabs">
<?php if($mem->reqLevel('comment')) { ?><li class="cd-active"><a href="#tabs" title="Add a comment to this user" rel="cd-act-comment" class="cd-tab">Comment</a></li><?php } ?>
<?php if($mem->reqLevel('greeting')) { ?><li><a href="#tabs" title="Edit this user's greeting" rel="cd-act-greeting" class="cd-tab">Greeting</a></li><?php } ?>
<?php if($mem->reqLevel('ban')) { ?><li><a href="#tabs" title="Add Ban/Tempban to this user" rel="cd-act-ban" class="cd-tab">Ban</a></li><?php } ?>
<?php if($mem->reqLevel('edit_client_level')) { ?><li><a href="#tabs" title="Change this user's user level" rel="cd-act-lvl" class="cd-tab">Change Level</a></li><?php } ?>
<?php if($mem->reqLevel('edit_mask')) { ?><li><a href="#tabs" title="Change this user's mask level" rel="cd-act-mask" class="cd-tab">Mask Level</a></li><?php } ?>
<?php
if(!$no_plugins_active)
$plugins->displayCDFormTab();
?>
</ul>
<div id="actions-box">
<?php
if($mem->reqLevel('comment')) :
$comment_token = genFormToken('comment');
?>
<div id="cd-act-comment" class="act-slide">
<form action="actions/b3/comment.php" method="post">
<label for="comment">Comment:</label><br />
<textarea type="text" name="comment" id="comment"></textarea>
<?php tooltip('Add a comment to this users Echelon profile'); ?>
<br />
<input type="hidden" name="token" value="<?php echo $comment_token; ?>" />
<input type="hidden" name="cid" value="<?php echo $cid; ?>" />
<input type="submit" name="comment-sub" value="Add Comment" />
</form>
</div>
<?php
endif;
if($mem->reqLevel('greeting')) :
$greeting_token = genFormToken('greeting');
?>
<div id="cd-act-greeting" class="act-slide">
<form action="actions/b3/greeting.php" method="post">
<label for="greeting">Greeting Message:</label><br />
<textarea name="greeting" id="greeting"><?php echo $greeting; ?></textarea><br />
<input type="hidden" name="token" value="<?php echo $greeting_token; ?>" />
<input type="hidden" name="cid" value="<?php echo $cid; ?>" />
<input type="submit" name="greeting-sub" value="Edit Greeting" />
</form>
</div>
<?php
endif;
if($mem->reqLevel('ban')) :
$ban_token = genFormToken('ban');
?>
<div id="cd-act-ban" class="act-slide">
<form action="actions/b3/ban.php" method="post">
<fieldset class="none">
<legend>Type</legend>
<label for="pb">Permanent Ban?</label>
<input type="checkbox" name="pb" id="pb" /><?php tooltip('Is this ban to last forever?'); ?><br />
<div id="ban-duration">
<label for="duration">Duration:</label>
<input type="text" name="duration" id="duration" class="int dur" /><?php tooltip('This is the number (eg. 3) of minutes/hours ect.'); ?>
<select name="time">
<option value="m">Minutes</option>
<option value="h">Hours</option>
<option value="d">Days</option>
<option value="w">Weeks</option>
<option value="mn">Months</option>
<option value="y">Years</option>
</select>
<?php tooltip('How long should this ban last'); ?>
</div>
</fieldset>
<br class="clear" />
<label for="reason">Reason:</label>
<input type="text" name="reason" id="reason" />
<input type="hidden" name="cid" value="<?php echo $cid; ?>" />
<input type="hidden" name="c-name" value="<?php echo $name; ?>" />
<input type="hidden" name="c-ip" value="<?php echo $ip; ?>" />
<input type="hidden" name="c-pbid" value="<?php echo $guid; ?>" />
<input type="hidden" name="token" value="<?php echo $ban_token; ?>" />
<input type="submit" name="ban-sub" value="Ban User" />
</form>
</div>
<?php
endif; // end hide ban section to non authed
$b3_groups = $db->getB3Groups(); // get a list of all B3 groups from the B3 DB
if($mem->reqLevel('edit_client_level')) :
$level_token = genFormToken('level');
?>
<div id="cd-act-lvl" class="act-slide">
<form action="actions/b3/level.php" method="post">
<label for="level">Level:</label>
<select name="level" id="level">
<?php
foreach($b3_groups as $group) :
$gid = $group['id'];
$gname = $group['name'];
if($group_bits == $gid)
echo '<option value="'.$gid.'" selected="selected">'.$gname.'</option>';
else
echo '<option value="'.$gid.'">'.$gname.'</option>';
endforeach;
?>
</select><br />
<div id="level-pw">
<label for="password">Your Current Password:</label>
<input type="password" name="password" id="password" />
<?php tooltip('We need your password to make sure it is really you'); ?>
<br />
</div>
<input type="hidden" name="old-level" value="<?php echo $group_bits; ?>" />
<input type="hidden" name="cid" value="<?php echo $cid; ?>" />
<input type="hidden" name="token" value="<?php echo $level_token; ?>" />
<input type="submit" name="level-sub" value="Change Level" />
</form>
</div>
<?php
endif; // end if
if($mem->reqLevel('edit_mask')) :
$mask_lvl_token = genFormToken('mask');
?>
<div id="cd-act-mask" class="act-slide">
<form action="actions/b3/level.php" method="post">
<label for="mlevel">Mask Level:</label>
<select name="level" id="mlevel">
<?php
foreach($b3_groups as $group) :
$gid = $group['id'];
$gname = $group['name'];
if($mask_level == $gid)
echo '<option value="'.$gid.'" selected="selected">'.$gname.'</option>';
else
echo '<option value="'.$gid.'">'.$gname.'</option>';
endforeach;
?>
</select>
<?php tooltip('Masking a user masks their user level from everyone in the game server, as whatever value is here'); ?>
<input type="hidden" name="old-level" value="<?php echo $group_bits; ?>" />
<input type="hidden" name="cid" value="<?php echo $cid; ?>" />
<input type="hidden" name="token" value="<?php echo $mask_lvl_token; ?>" />
<input type="submit" name="mlevel-sub" value="Change Mask" />
</form>
</div>
<?php
endif;
## Plugins CD Form ##
if(!$no_plugins_active)
$plugins->displayCDForm($cid)
?>
</div><!-- end #actions-box -->
</div><!-- end #actions -->
<!-- Start Client Aliases -->
<h3 class="cd-h">Aliases</h3>
<table>
<thead>
<tr>
<th>Alias</th>
<th>Times Used</th>
<th>First Used</th>
<th>Last Used</th>
</tr>
</thead>
<tfoot>
<tr><th colspan="4"></th></tr>
</tfoot>
<tbody>
<?php
// notice on the query we say that time_add does not equal time_edit, this is because of bug in alias recording in B3 that has now been solved
$query = "SELECT alias, num_used, time_add, time_edit FROM aliases WHERE client_id = ? ORDER BY time_edit DESC";
$stmt = $db->mysql->prepare($query) or die('Alias Database Query Error'. $db->mysql->error);
$stmt->bind_param('i', $cid);
$stmt->execute();
$stmt->bind_result($alias, $num_used, $time_add, $time_edit);
$stmt->store_result(); // needed for the $stmt->num_rows call
if($stmt->num_rows) :
while($stmt->fetch()) :
$time_add = date($tformat, $time_add);
$time_edit = date($tformat, $time_edit);
$alter = alter();
$token_del = genFormToken('del'.$id);
// setup heredoc (table data)
$data = <<<EOD
<tr class="$alter">
<td><strong>$alias</strong></td>
<td>$num_used</td>
<td><em>$time_add</em></td>
<td><em>$time_edit</em></td>
</tr>
EOD;
echo $data;
endwhile;
else : // if there are no aliases connected with this user then put out a small and short message
echo '<tr><td colspan="4">'.$name.' has no aliaises.</td></tr>';
endif;
?>
</tbody>
</table>
<?php
//this is sub optimal, but without a better way to check b3 version...
$result = $db->query("SHOW TABLES LIKE 'ipaliases'");
if($result["num_rows"]):
?>
<h3 class="cd-h">IP Aliases</h3>
<table>
<thead>
<tr>
<th>IP</th>
<th>Times Used</th>
<th>First Used</th>
<th>Last Used</th>
</tr>
</thead>
<tfoot>
<tr><th colspan="4"></th></tr>
</tfoot>
<tbody>
<?php
// notice on the query we say that time_add does not equal time_edit, this is because of bug in alias recording in B3 that has now been solved
$query = "SELECT ip, num_used, time_add, time_edit FROM ipaliases WHERE client_id = ? ORDER BY time_edit DESC";
$stmt = $db->mysql->prepare($query) or die('IP Alias Database Query Error'. $db->mysql->error);
$stmt->bind_param('i', $cid);
$stmt->execute();
$stmt->bind_result($ip, $num_used, $time_add, $time_edit);
$stmt->store_result(); // needed for the $stmt->num_rows call
if($stmt->num_rows) :
while($stmt->fetch()) :
$time_add = date($tformat, $time_add);
$time_edit = date($tformat, $time_edit);
$alter = alter();
$token_del = genFormToken('del'.$id);
// setup heredoc (table data)
$data = <<<EOD
<tr class="$alter">
<td><a href="clients.php?s=$ip"><strong>$ip</strong></a></td>
<td>$num_used</td>
<td><em>$time_add</em></td>
<td><em>$time_edit</em></td>
</tr>
EOD;
echo $data;
endwhile;
else : // if there are no aliases connected with this user then put out a small and short message
echo '<tr><td colspan="4">'.$name.' has no other IP\'s.</td></tr>';
endif;
?>
</tbody>
</table>
<?php endif; ?>
<!-- Start Client Echelon Logs -->
<?php
## Get Echelon Logs Client Logs (NOTE INFO IN THE ECHELON DB) ##
$ech_logs = $dbl->getEchLogs($cid, $game);
$count = count($ech_logs);
if($count > 0) : // if there are records
?>
<h3 class="cd-h cd-slide" id="cd-log">Echelon Logs<img class="cd-open" src="images/add.png" alt="Open" /></h3>
<table id="cd-log-table" class="slide-panel">
<thead>
<tr>
<th>id</th>
<th>Type</th>
<th>Message</th>
<th>Time Added</th>
<th>Admin</th>
</tr>
</thead>
<tfoot>
<tr><th colspan="5"></th></tr>
</tfoot>
<tbody>
<?php displayEchLog($ech_logs, 'client'); ?>
</tbody>
</table>
<?php
endif; // end hide is no records
?>
<!-- Client Penalties -->
<div id="penalties">
<h3 class="cd-h cd-slide" id="cd-pen">Penalties <img class="cd-open" src="images/add.png" alt="Open" /></h3>
<table id="cd-pen-table" class="slide-panel">
<thead>
<tr>
<th></th>
<th>Type</th>
<th>Added</th>
<th>Duration</th>
<th>Expires</th>
<th>Reason</th>
<th>Admin</th>
</tr>
</thead>
<tfoot>
<tr><td colspan="7"></td></tr>
</tfoot>
<tbody id="contain-pen">
<?php
$type_inc = 'client';
include 'inc/cd/penalties.php';
?>
</tbody>
</table>
</div>
<!-- Admin History -->
<div id="admin">
<h3 class="cd-h cd-slide" id="cd-admin">Admin Actions <img class="cd-open" src="images/add.png" alt="Open" /></h3>
<table id="cd-admin-table" class="slide-panel">
<thead>
<tr>
<th></th>
<th>Type</th>
<th>Added</th>
<th>Duration</th>
<th>Expires</th>
<th>Reason</th>
<th>Client</th>
</tr>
</thead>
<tfoot>
<tr><td colspan="7"></td></tr>
</tfoot>
<tbody id="contain-admin">
<?php
$type_inc = 'admin';
include 'inc/cd/penalties.php';
?>
</tbody>
</table>
</div>
<?php
## Plugins Log Include Area ##
if(!$no_plugins_active)
$plugins->displayCDlogs($cid);
// Close page off with the footer
require 'inc/footer.php';
?>