<?php
session_start();
require_once __DIR__ . '/../../config/db.php';

if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
    header("Location: ../../auth/login.php");
    exit;
}

$id = $_GET['id'] ?? null;
$project_id = $_GET['project_id'] ?? null;

if ($id && $project_id) {
    $stmt = $pdo->prepare("DELETE FROM project_memberships WHERE id = ?");
    $stmt->execute([$id]);
}

header("Location: assign_member.php?id=" . $project_id);
exit;
