<?php
require_once __DIR__ . '/../config/database.php';

if (!empty($_SESSION['user_id'])) {
    registrar_auditoria(
        $conn,
        'LOGOUT',
        'usuarios',
        $_SESSION['user_id'],
        'Salida del sistema'
    );
}

$_SESSION = [];
session_destroy();
header('Location: /HM/auth/login.php');
exit;
