This repository was archived by the owner on May 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy patheditPlayer.php
More file actions
337 lines (278 loc) · 9.71 KB
/
editPlayer.php
File metadata and controls
337 lines (278 loc) · 9.71 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
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
<?php
error_reporting(0);
session_start();
ob_start();
$version = '';
if (!isset($_SESSION['logged'])) {
header('Location: index.php');
die();
}
$staffPerms = $_SESSION['perms'];
$user = $_SESSION['user'];
include 'verifyPanel.php';
masterconnect();
$guidPlayer = htmlspecialchars($_POST['guid']);
$uidPlayer = mysqli_real_escape_string($dbcon, $_POST['hidden']);
$sql = "SELECT * FROM `players` WHERE uid = '$uidPlayer'";
$result = mysqli_query($dbcon, $sql);
$player = $result->fetch_object();
$username = utf8_encode($player->name);
$pid = playerID($player);
include 'header/header.php';
?>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 style = "margin-top: 70px">Edit Player</h1>
<p class="page-header">Edit player menu of the panel, allows you to change values in more depth.</p>
<div id="alert-area"></div>
<form action='editPlayer.php' method='post'>
<div class="btn-group" role="group" aria-label="...">
<input class = 'btn btn-primary btn-outline' type='submit' name='remove' value='Reset Civ Licenses'>
</div>
<div class="btn-group" role="group" aria-label="...">
<input class = 'btn btn-primary btn-outline' type='submit' name='give' value='Give All Civ Licenses'>
</div>
<input type=hidden name=hidden value= <?php echo $uidPlayer; ?> >
<input type=hidden name=guid value= <?php echo $guidPlayer; ?> >
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-primary btn-outline" data-toggle="modal" data-target="#myModal">Player Inventory</button>
</form>
</div>
<br>
<div class="modal fade bd-example-modal-lg" id='myModal' tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">Player Inventory</h4>
</div>
<div class="modal-body">
<div class='panel panel-info'>
<div class='panel-heading'>
<h3 class='panel-title'>Civilian Inventory</h3>
</div>
<div class='panel-body'>
<div class="well well-lg"><pre> <?php echo $player->civ_gear; ?> </pre></div>
</div>
</div>
<div class='panel panel-info'>
<div class='panel-heading'>
<h3 class='panel-title'>Cop Inventory</h3>
</div>
<div class='panel-body'>
<div class="well well-lg"><pre> <?php echo $player->cop_gear; ?> </pre></div>
</div>
</div>
<div class='panel panel-info'>
<div class='panel-heading'>
<h3 class='panel-title'>Medic Inventory</h3>
</div>
<div class='panel-body'>
<div class="well well-lg"><pre> <?php echo $player->med_gear; ?> </pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class='panel panel-info'>
<div class='panel-heading'>
<h3 class='panel-title'>Player Info</h3>
</div>
<div class='panel-body'>
<?php
echo "<div class='lic'>";
echo "<div id ='editPlayer'><center><h1>".$username.'</h1></center>';
echo '<center><h4>UID: '.$player->uid.'</h3></center>';
echo '<center><h4>Player ID: '.$pid.'</h3></center>';
echo '<center><h4>GUID: '.$guidPlayer.'</h3></center>';
echo '<center><h4>Bank: $'.$player->bankacc.'</h3></center>';
echo '<center><h4>Cash: $'.$player->cash.'</h3></center>';
echo '<center><h4>Cop Level: '.$player->coplevel.'</h3></center>';
echo '<center><h4>Medic Level: '.$player->mediclevel.'</h3></center>';
echo '<center><h4>Admin Level: '.$player->adminlevel.'</h3></center>';
echo '</div>';
echo ' </div> </div> </div>';
echo "<div class='panel panel-info'>
<div class='panel-heading'>
<h3 class='panel-title'>Edit Player</h3>
</div>
<div class='panel-body'>";
?>
<div class="table-responsive">
<table class="table table-striped" style = "margin-top: -10px">
<thead>
<tr>
<th>Donator Level</th>
<th>Blacklisted</th>
</tr>
</thead>
<tbody>
<?php
$sqlget = "SELECT * FROM players WHERE uid='$uidPlayer';";
$search_result = mysqli_query($dbcon, $sqlget) or die('Connection could not be established');
while ($row = mysqli_fetch_array($search_result, MYSQLI_ASSOC)) {
if ($row['donorlevel'] != '' || $row['donatorlvl'] != '') {
if ($row['donorlevel'] == '') {
$don = $row['donatorlvl'];
$version = 'donatorlvl';
} else {
$don = $row['donorlevel'];
$version = 'donorlevel';
}
}
echo '<tr>';
outputSelection($maxDonator, $version, $don, $row['uid']);
outputSelection(1, 'blacklist', $row['blacklist'], $row['uid']);
echo '</tr>';
}
echo '</table></div>';
echo '</div>';
echo '</div>';
echo "<div class='panel panel-info'>
<div class='panel-heading'>
<h3 class='panel-title'>Player Notes</h3>
</div>
<div class='panel-body'>";
?>
<div class="table-responsive">
<table class="table table-striped" style = "margin-top: -10px">
<thead>
<tr>
<th>Added by</th>
<th>Note</th>
<th>Date added</th>
</tr>
</thead>
<tbody>
<?php
$sqlget = "SELECT * FROM notes WHERE uid=$uidPlayer;";
$search_result = mysqli_query($dbcon, $sqlget) or die('Connection could not be established');
while ($row = mysqli_fetch_array($search_result, MYSQLI_ASSOC)) {
if ($row['warning'] == 2) {
echo '<tr class = "warning">';
} elseif ($row['warning'] == 3) {
echo '<tr class = "danger">';
} else {
echo '<tr>';
}
echo '<td>'.$row['staff_name'].' </td>';
echo '<td>'.$row['note_text'].' </td>';
echo '<td>'.$row['note_updated'].' </td>';
echo '</tr>';
}
echo '</table></div>';
echo '</div>';
echo '</div>';
echo "<div id ='civlic'>";
if ($player->civ_licenses !== '"[]"' && $player->civ_licenses !== '') {
$return = explode('],[', $player->civ_licenses);
echo "<div class='panel panel-info'>
<div class='panel-heading'>
<h3 class='panel-title'>Civ Licenses</h3>
</div>
<div class='panel-body'>";
foreach ($return as $value) {
license($value, $staffPerms);
}
echo ' </div>
</div>';
}
echo '</div>';
echo "<div id ='civlic1'>";
if ($player->med_licenses !== '"[]"' && $player->med_licenses !== '[]') {
$return = explode('],[', $player->med_licenses);
echo "<div class='panel panel-info'>
<div class='panel-heading'>
<h3 class='panel-title'>Medic Licenses</h3>
</div>
<div class='panel-body'>";
foreach ($return as $value) {
license($value, $staffPerms);
}
echo ' </div>
</div>';
}
echo '</div>';
echo "<div id ='civlic2'>";
if ($player->cop_licenses !== '"[]"' && $player->cop_licenses !== '') {
$return = explode('],[', $player->cop_licenses);
echo "<div class='panel panel-info'>
<div class='panel-heading'>
<h3 class='panel-title'>Cop Licenses</h3>
</div>
<div class='panel-body'>";
foreach ($return as $value) {
license($value, $staffPerms);
}
echo '</div></div>';
}
echo '</div></div>';
echo "<div id ='licCheck'><h5></h5>";
echo '</div>';
if (isset($_POST['remove'])) {
if ($staffPerms['editPlayer'] == '1') {
$licReset = str_replace('1', '0', $player->civ_licenses);
$sql = "UPDATE `players` SET `civ_licenses`='$licReset' WHERE uid ='$uidPlayer'";
$result = mysqli_query($dbcon, $sql);
$message = 'Admin '.$user.' has removed all licenses from '.utf8_encode($player->name).'('.$pid.')';
logIt($user, $message, $dbcon);
}
}
if (isset($_POST['give'])) {
$uidPlayer = $_POST['hidden'];
if ($staffPerms['editPlayer'] == '1') {
$licReset = str_replace('0', '1', $player->civ_licenses);
$sql = "UPDATE `players` SET `civ_licenses`='$licReset' WHERE uid ='$uidPlayer'";
$result = mysqli_query($dbcon, $sql);
$message = 'Admin '.$user.' has added all licenses to '.utf8_encode($player->name).'('.$pid.')';
logIt($user, $message, $dbcon);
}
}
?>
<script>
function post (id)
{
var newid = "#" + id;
$(newid).toggleClass("btn-danger btn-success");
$.post('Backend/changeLicense.php',{id:id,uid:'<?php echo $uidPlayer; ?>'},
function(data)
{
});
}
function post1 (id)
{
var newid = "#" + id;
$(newid).toggleClass("btn-danger btn-success");
var newid = id;
$.post('Backend/changeLicense.php',{id:id,uid:'<?php echo $uidPlayer; ?>'},
function(data)
{
});
}
function newAlert (type, message) {
$("#alert-area").append($("<div class='alert " + type + " fade in' data-alert><p> " + message + " </p></div>"));
$(".alert").delay(2000).fadeOut("slow", function () { $(this).remove(); });
}
function dbSave(value, uid, column, original){
if (value != original) {
newAlert('alert-success', 'Value Updated!');
$.post('Backend/updatePlayers.php',{column:column, editval:value, uid:uid},
function(){
//alert("Sent values.");
});
};
}
</script>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="dist/js/bootstrap.min.js"></script>
</body>
</html>