-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings_manager.php
More file actions
29 lines (19 loc) · 830 Bytes
/
settings_manager.php
File metadata and controls
29 lines (19 loc) · 830 Bytes
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
<?php
include("DBConnector.php");
$data = json_decode(file_get_contents("php://input"), true);
if ($data[0] == "set"){//We are setting new things
//Data will contain:operation, currUser, setting that's changing, value of setting
if ($data[2] == "bio"){
$data[3] = addslashes($data[3]);
}
$query_changeBackColor = "UPDATE users SET $data[2] = '$data[3]' WHERE username = '$data[1]'";
mysqli_query($conn, $query_changeBackColor);
echo "success";
}
else{//We are retrieving info
$query_getSettings = "SELECT image,bio,theme,back_image,back_color FROM users WHERE username = '$data[1]'";
$result = mysqli_query($conn, $query_getSettings);
$row = mysqli_fetch_assoc($result);
echo json_encode($row);
}
?>