forked from chinakimi/AdminPanel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
changePerms.php
40 lines (28 loc) · 879 Bytes
/
changePerms.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
<?php
session_start();
ob_start();
$staffPerms = $_SESSION['perms'];
$user = $_SESSION['user'];
if (!isset($_SESSION['logged'])) {
header('Location: index.php');
die();
}
if ($staffPerms['superUser'] == '1') {
include 'verifyPanel.php';
masterconnect();
$id = $_POST['id'];
$staffId = $_POST['uid'];
$change = explode('_', $_POST['id']);
$sql = "SELECT * FROM `users` WHERE ID = $staffId";
$result = mysqli_query($dbcon, $sql);
$user = $result->fetch_object();
$licences = $user->permissions;
$num = strpos($licences, $change['0']) + strlen($change['0']) + 2;
if ($licences[$num] == 0) {
$licences[$num] = 1;
} elseif ($licences[$num] == 1) {
$licences[$num] = 0;
}
$sql = "UPDATE `users` SET `permissions` = '$licences' WHERE ID = $staffId";
$result = mysqli_query($dbcon, $sql);
}