<?php

require_once __DIR__.'/../db.php';

session_start();

if(empty($_SESSION['user_id'])){
    header("Location: ../index.html");
    exit;
}

$pdo = db();

$id = (int)($_GET['id'] ?? 0);

if($id){

    $stmt = $pdo->prepare("DELETE FROM contracts WHERE id=?");
    $stmt->execute([$id]);

}

header("Location: index.php");
exit;