false,'message'=>'Unauthorized']); exit; } $type = $_POST['type'] ?? ''; $id = intval($_POST['id'] ?? 0); $allowed = ['booking']; if (!in_array($type, $allowed)) { echo json_encode(['success'=>false,'message'=>'Invalid type']); exit; } if ($type == 'booking') { $conn->query("DELETE FROM bookings WHERE id=$id"); echo json_encode(['success'=>true,'message'=>'Deleted']); exit; } echo json_encode(['success'=>false,'message'=>'Unknown type']);