-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdelete-user.php
More file actions
22 lines (21 loc) · 802 Bytes
/
delete-user.php
File metadata and controls
22 lines (21 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: access");
header("Access-Control-Allow-Methods: POST");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
require 'db_connection.php';
$data = json_decode(file_get_contents("php://input"));
if(isset($data->id) && is_numeric($data->id)){
$delID = $data->id;
$deleteUser = mysqli_query($db_conn,"DELETE FROM `users` WHERE `id`='$delID'");
if($deleteUser){
echo json_encode(["success"=>1,"msg"=>"User Deleted"]);
}
else{
echo json_encode(["success"=>0,"msg"=>"User Not Found!"]);
}
}
else{
echo json_encode(["success"=>0,"msg"=>"User Not Found!"]);
}