<?php
    session_start();
    require_once('models/User.php');
    if (!isset($_SESSION['login'])) {
        header('Location: signin.php');
    }
    

    try {
        $user = new User($_SESSION['login']);
        $user->delete();
        header('Location: signup.php');
        exit();
    }
    catch (PDO $e) {
        $_SESSION['message'] = $e->getMessage();
        header('Location: signin.php');
        exit();
    }
