This repository has been archived by the owner on May 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathplayers.php
executable file
·287 lines (268 loc) · 12.2 KB
/
players.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
<?php
session_start();
ob_start();
if (!isset($_SESSION['logged'])) {
header('Location: index.php');
die();
}
$staffPerms = $_SESSION['perms'];
$user = $_SESSION['user'];
include 'verifyPanel.php';
masterconnect();
$page1 = $_GET['page'];
if ($page1 == '' || $page1 == '1') {
$page = 0;
} else {
$page = ($page1 * 50) - 50;
}
$resultQ = 'SELECT uid FROM players';
$result = mysqli_query($dbcon, $resultQ) or die('Connection could not be established');
$count = mysqli_num_rows($result);
$amount = $count / 50;
$amount = ceil($amount) + 1;
$currentpage = $page1;
$minusPage = $currentpage - 1;
if ($minusPage < 1) {
$minusPage = 1;
}
$addPage = $currentpage + 1;
if ($addPage > $amount) {
$addPage = $amount;
}
$max = PHP_INT_MAX;
switch ($_GET['search']) {
case 'cash':
$search = 'cash';
break;
case 'bank':
$search = 'bank';
break;
case 'cop':
$search = 'cop';
break;
case 'medic':
$search = 'medic';
break;
case 'admin':
$search = 'admin';
break;
default:
$search = 'Nope';
break;
}
if (isset($_POST['search'])) {
$valuetosearch = $_POST['SearchValue'];
$sqlget = "SELECT * FROM players WHERE CONCAT (`name`,`playerid`,`uid`, `aliases`) LIKE '%".$valuetosearch."%'";
$search_result = filterTable($dbcon, $sqlget);
if ($search_result == '') {
$sqlget = "SELECT * FROM players WHERE CONCAT (`name`,`pid`,`uid`, `aliases`) LIKE '%".$valuetosearch."%'";
$search_result = filterTable($dbcon, $sqlget);
}
} elseif (isset($_POST['orderBank']) || $_GET['search'] == 'bank') {
$sqlget = 'SELECT * FROM players ORDER BY bankacc DESC limit '.$page.',50';
$search_result = filterTable($dbcon, $sqlget);
} elseif (isset($_POST['orderCash']) || $_GET['search'] == 'cash') {
$sqlget = 'SELECT * FROM players ORDER BY cash DESC limit '.$page.',50';
$search_result = filterTable($dbcon, $sqlget);
} elseif (isset($_POST['orderCop']) || $_GET['search'] == 'cop') {
$sqlget = 'SELECT * FROM players ORDER BY coplevel DESC limit '.$page.',50';
$search_result = filterTable($dbcon, $sqlget);
} elseif (isset($_POST['orderMedic']) || $_GET['search'] == 'medic') {
$sqlget = 'SELECT * FROM players ORDER BY mediclevel DESC limit '.$page.',50';
$search_result = filterTable($dbcon, $sqlget);
} elseif (isset($_POST['orderAdmin']) || $_GET['search'] == 'admin') {
$sqlget = 'SELECT * FROM players ORDER BY adminlevel DESC limit '.$page.',50';
$search_result = filterTable($dbcon, $sqlget);
} else {
$sqlget = 'SELECT * FROM players limit '.$page.',50';
$search_result = filterTable($dbcon, $sqlget);
}
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">Player Menu</h1>
<p class="page-header">Player menu of the panel, allows you to change players database values.</p>
<div id="alert-area"></div>
<?php
switch ($staffPerms) {
case $staffPerms['ban'] == '1':
echo "<div class=\"btn-group\" role=\"group\" aria-label=\"...\">
<FORM METHOD=\"LINK\" ACTION=\"rCon/player.php\">
<INPUT class='btn btn-primary btn-outline' TYPE=\"submit\" VALUE=\"Ban Player\">
</FORM>
</div>";
case $staffPerms['unban'] == '1':
echo "<div class=\"btn-group\" role=\"group\" aria-label=\"...\">
<FORM METHOD=\"LINK\" ACTION=\"rCon/unBan.php\">
<INPUT class='btn btn-primary btn-outline' TYPE=\"submit\" VALUE=\"Unban Player\">
</FORM>
</div>";
case $staffPerms['kick'] == '1':
echo "<div class=\"btn-group\" role=\"group\" aria-label=\"...\">
<FORM METHOD=\"LINK\" ACTION=\"rCon/Kmenu.php\">
<INPUT class='btn btn-primary btn-outline' TYPE=\"submit\" VALUE=\"Kick Player\">
</FORM>
</div>";
case $staffPerms['notes'] == '1':
echo "<div class=\"btn-group\" role=\"group\" aria-label=\"...\">
<FORM METHOD=\"LINK\" ACTION=\"notes.php\" STYLE = \"display: inline;\">
<INPUT class='btn btn-primary btn-outline' TYPE=\"submit\" VALUE=\"Notes Menu\">
</FORM>
</div>";
}
?>
<form action = "players.php" method="post">
<div class ="searchBar">
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" style = "width: 300px;" name="SearchValue" placeholder="Player name/UID/ID...">
<span class="input-group-btn">
<input class="btn btn-default" name="search" type="submit" value="Search">
</span>
</div><!-- /input-group -->
</div><!-- /.col-lg-6 -->
</div><!-- /.row -->
</div>
</form>
<br>
<div class="table-responsive">
<table class="table table-striped" style = "margin-top: 0px">
<thead>
<tr>
<th>ID</th>
<th>Player Name</th>
<th>Alias</th>
<th>UID</th>
<th>GUID</th>
<th><form action = "players.php?search=cash" method="post"><input class='btn-link' type='submit' name='orderCash' value="Player Cash"></form></th>
<th><form action = "players.php?search=bank" method="post"><input class='btn-link' type='submit' name='orderBank' value="Player Bank"></form></th>
<th><form action = "players.php?search=cop" method="post"><input class='btn-link' type='submit' name='orderCop' value="Cop Level"></form></th>
<th><form action = "players.php?search=medic" method="post"><input class='btn-link' type='submit' name='orderMedic' value="Medic Level"></form></th>
<th><form action = "players.php?search=admin" method="post"><input class='btn-link' type='submit' name='orderAdmin' value="Admin Level"></form></th>
<th>View Stats</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($search_result, MYSQLI_ASSOC)) {
if ($row['playerid'] != '' || $row['pid'] != '') {
if ($row['playerid'] == '') {
$pid = $row['pid'];
} else {
$pid = $row['playerid'];
}
}
$return = guid($max, $pid);
$alias = explode('`', $row['aliases']);
echo '<tr>';
echo '<td>'.$row['uid'].'</td>';
echo '<td>'.utf8_encode($row['name']).' </td>';
echo '<td>'.utf8_encode($alias[1]).' </td>';
echo '<td>'.$pid.' </td>';
echo '<td>'.$return.'</td>';
echo '<td>' ?>
<input class="form-control" onBlur="dbSave(this.value, '<?php echo $row['uid']; ?>', 'cash', '<?php echo $row['cash']; ?>')"; type=text value= "<?php echo $row['cash']; ?>" >
<?php
echo '</td>';
echo '<td>' ?>
<input class="form-control" onBlur="dbSave(this.value, '<?php echo $row['uid']; ?>', 'bankacc', '<?php echo $row['bankacc']; ?>')"; type=text value= "<?php echo $row['bankacc']; ?>" >
<?php
echo '</td>';
outputSelection($maxCop, 'coplevel', $row['coplevel'], $row['uid']);
outputSelection($maxMedic, 'mediclevel', $row['mediclevel'], $row['uid']);
outputSelection($maxAdmin, 'adminlevel', $row['adminlevel'], $row['uid']);
echo '<form action=editPlayer.php method=post>';
echo '<td>'."<input class='btn btn-primary btn-outline' type=submit name=edit id=edit value=View".' ></td>';
echo "<td style='display:none;'>".'<input type=hidden name=hidden value='.$row['uid'].'> </td>';
echo "<td style='display:none;'>".'<input type=hidden name=guid value='.$return.'> </td>';
echo '</form>';
echo '</tr>';
}
echo '</table></div>';
?>
<nav>
<ul class="pagination">
<?php if ($currentpage != 1) {
?>
<li>
<a href="players.php?search=<?php echo $search; ?>&page=<?php echo $minusPage; ?>" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<?php
} else {
?>
<li class = "disabled">
<a href="players.php?search=<?php echo $search; ?>&page=<?php echo $minusPage; ?>" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<?php
}
$amountPage = $currentpage + 2;
$pageBefore = $currentpage - 2;
if ($pageBefore == 0) {
$pageBefore = 1;
$amountPage = $amountPage + 1;
}
if ($pageBefore < 1) {
$pageBefore = 1;
$amountPage = $amountPage + 2;
}
for ($b = $pageBefore; $b <= $amountPage; ++$b) {
if ($b >= $amount) {
?><li class = "disabled"><a href = "players.php?search=<?php echo $search; ?>&page=<?php echo $b; ?>" style = "text-decoration:none"><?php echo $b.' '; ?></a><li><?php
} else {
if ($b == $currentpage) {
?><li class = "active"><a href = "players.php?search=<?php echo $search; ?>&page=<?php echo $b; ?>" style = "text-decoration:none"><?php echo $b.' '; ?></a><li><?php
} else {
?><li><a href = "players.php?search=<?php echo $search; ?>&page=<?php echo $b; ?>" style = "text-decoration:none"><?php echo $b.' '; ?></a><li><?php
}
}
}
if ($currentpage != $amount) {
?>
<li>
<a href="players.php?search=<?php echo $search; ?>&page=<?php echo $addPage; ?>" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
<?php
} else {
?>
<li class = "disabled">
<a href='players.php?search=<?php echo $search; ?>&page=<?php echo $minusPage; ?>' aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
<?php
}
?>
</ul>
</nav>
<script>
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>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="dist/js/bootstrap.min.js"></script>
</body>
</html>