<?php
require_once __DIR__ . '/../includes/functions.php';
requireAdmin();
if ($_SERVER['REQUEST_METHOD'] !== 'POST') jsonResponse(['success'=>false,'error'=>'Method not allowed'], 405);

$id = (int)($_POST['id'] ?? 0);
if (!$id) jsonResponse(['success'=>false,'error'=>'Invalid ID.']);

$db   = getDB();
$stmt = $db->prepare("DELETE FROM members WHERE id = ?");
$stmt->execute([$id]);

jsonResponse(['success'=>true]);
