<?php
require_once __DIR__ . '/../includes/init.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST' && validateCsrfToken($_POST['csrf_token'] ?? '')) {
    session_unset();
    session_destroy();
    // Clear cookie
    setcookie(session_name(), '', time() - 3600, '/');
}
redirect(BASE_URL . '/auth/login.php');
