<?php
session_start();
include 'config.php';

if (!isset($_SESSION['username']) || ($_SESSION['role'] != 'Super Admin' && $_SESSION['role'] != 'Admin')) {
    header("Location: index.php");
    exit();
}

if (isset($_GET['id'])) {
    $document_id = $_GET['id'];
    $conn->query("DELETE FROM documents WHERE id=$document_id");
    $conn->query("DELETE FROM document_status WHERE document_id=$document_id");
    header("Location: dashboard.php");
} else {
    header("Location: dashboard.php");
}
?>
