<?php include "../../root.class.php";
$html = new html();
$html->add_styles_page();
$db = new db_safeguard();
session_start();

try {
    if (!isset($_SESSION['user_id'])) {
        throw new Exception("User not logged in.");
    }

    $user_id = $_SESSION['user_id'];
    $signature_path = "../signature/images/a-{$user_id}-signature.png";

    if (!file_exists($signature_path)) {
        throw new Exception("Signature not found.");
    }

    if (!unlink($signature_path)) {
        throw new Exception("Failed to delete the signature.");
    }

    // echo 1;
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
