-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_post.php
More file actions
31 lines (25 loc) · 795 Bytes
/
admin_post.php
File metadata and controls
31 lines (25 loc) · 795 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
30
31
<?php
require_once 'functions/functions.php';
require_once 'functions/user.php';
function delete_user($data) {
if (user\delete_user($data['user_id']))
return functions\json_respond('OK', 'Deleted!');
else
return functions\json_respond('ERROR', 'Couldn\'t delete user.');
}
function update_user($data) {
if (user\update_user($data))
return functions\json_respond('OK', 'Updated!');
else
return functions\json_respond('ERROR', 'Couldn\'t update user.');
}
if ($_POST) {
$data = json_decode($_POST['data'], true);
if ($data['method'] == 'delete_user')
delete_user($data);
elseif ($data['method'] == 'update_user')
update_user($data);
else
return functions\json_respond('ERROR', 'Unknown method.');
}
?>