-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathjailuser.php
88 lines (87 loc) · 2.75 KB
/
jailuser.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
<?php
declare(strict_types=1);
/**
* MCCodes v2 by Dabomstew & ColdBlooded
*
* Repository: https://github.com/davemacaulay/mccodesv2
* License: MIT License
*/
global $db, $ir, $userid, $h;
require_once('globals.php');
if (!check_access('manage_punishments')) {
echo 'You cannot access this area.
<br />> <a href="index.php">Go Home</a>';
$h->endpage();
exit;
}
$_POST['user'] =
(isset($_POST['user']) && is_numeric($_POST['user']))
? abs(intval($_POST['user'])) : '';
$_POST['reason'] =
(isset($_POST['reason'])
&& ((strlen($_POST['reason']) > 3)
&& (strlen($_POST['reason']) < 50)))
? $db->escape(strip_tags(stripslashes($_POST['reason']))) : '';
$_POST['days'] =
(isset($_POST['days']) && is_numeric($_POST['days']))
? abs(intval($_POST['days'])) : '';
if (!empty($_POST['user']) && !empty($_POST['reason'])
&& !empty($_POST['days']))
{
if (!isset($_POST['verf'])
|| !verify_csrf_code('jailuser', stripslashes($_POST['verf'])))
{
echo '<h3>Error</h3><hr />
This operation has been blocked for your security.<br />
Please try again.<br />
> <a href="jailuser.php?userid=' . $_POST['user']
. '">Try Again</a>';
$h->endpage();
exit;
}
if (check_access('administrator', $_POST['user']))
{
echo 'You cannot fed admins, please destaff them first.
<br />> <a href="jailuser.php">Go Back</a>';
$h->endpage();
exit;
}
$db->query(
"UPDATE `users`
SET `fedjail` = 1
WHERE `userid` = {$_POST['user']}");
$db->query(
"INSERT INTO `fedjail`
VALUES(NULL, {$_POST['user']}, {$_POST['days']}, $userid,
'{$_POST['reason']}')");
$db->query(
"INSERT INTO `jaillogs`
VALUES(NULL, $userid, {$_POST['user']}, {$_POST['days']},
'{$_POST['reason']}', " . time() . ')');
echo 'User was fedded.<br />
> <a href="index.php">Go Home</a>';
}
else
{
$jail_csrf = request_csrf_code('jailuser');
$_GET['userid'] =
(isset($_GET['userid']) && is_numeric($_GET['userid']))
? abs(intval($_GET['userid'])) : -1;
echo "
<h3>Jailing User</h3>
The user will be put in fed jail and will be unable to do anything in the game.
<br />
<form action='jailuser.php' method='post'>
User: " . user_dropdown('user', $_GET['userid'])
. "
<br />
Days: <input type='text' name='days' />
<br />
Reason: <input type='text' name='reason' />
<br />
<input type='hidden' name='verf' value='{$jail_csrf}' />
<input type='submit' value='Jail User' />
</form>
";
}
$h->endpage();