<?php
session_start();
include 'includes/auth.php';
include 'includes/db.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['member_id'])) {
    $member_id = (int)$_POST['member_id'];

    // Unban the member
    $stmt = $conn->prepare("UPDATE members SET banned = 0 WHERE id = ?");
    $stmt->bind_param('i', $member_id);
    $stmt->execute();
    $stmt->close();
}

// Redirect back
$redirect = $_SERVER['HTTP_REFERER'] ?? 'members_active.php';
header("Location: $redirect");
exit;
