<?php
session_start();
include 'includes/conn.php';
include 'includes/functions.php';

// If a user is logged in, mark them offline before logout
if (isset($_SESSION['user_id'])) {
    markUserOffline($pdo, $_SESSION['user_id']);
}

// Destroy all session data
session_unset();
session_destroy();

// Redirect to login page
header("Location: index.php");
exit();
?>
