-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings_handler.php
More file actions
46 lines (40 loc) · 1.03 KB
/
settings_handler.php
File metadata and controls
46 lines (40 loc) · 1.03 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
<?php
session_start();
require_once("sql_connect.php");
if(!isset($_SESSION["user_id"])){
exit("Error!");
}
if(isset($_POST["perm"])){
$sql2 = "UPDATE users SET all_map_access='{$_POST["perm"]}' WHERE userID='{$_SESSION["user_id"]}'";
if(mysqli_query($conn, $sql2)){
echo "Applied";
exit;
}else{
echo "error!";
exit;
}
}
if(isset($_POST["pswrd"])){
$pswd = mysqli_real_escape_string($conn, $_POST["pswrd"]);
$sql2 = "UPDATE users SET password='{$pswd}' WHERE userID='{$_SESSION["user_id"]}'";
if(mysqli_query($conn, $sql2)){
echo "Changed";
exit;
}else{
echo "Error!";
exit;
}
}
if(isset($_POST["logout"])){
$status = "Offline";
$sql = mysqli_query($conn, "UPDATE users SET status = '{$status}' WHERE userID='{$_SESSION["user_id"]}'");
if($sql){
session_unset();
session_destroy();
//header("location:index.php");
exit;
}else{
//header("location:index.php");
exit;
}
}