<?php
require_once "../base.php";
session_start();
if(!isset($_SESSION["userId"]))header("Location: /storage/login.php");
if(!isAdmin($_SESSION["userId"])){
    http_response_code(403);
    print("Forbidden, you don't have access to this resource.");
    exit;
}
if(!isset($_GET['id'])){
    http_response_code(412);
    print("missing parameters");
}
require "../db.php";
$stmt=$pdo->prepare("DELETE FROM shelf WHERE id=?");
$stmt->execute([$_GET['id']]);
header("Location: list.php");
?>