<?php
session_start();
$timeout = 600;

if (!isset($_SESSION['user_id'])) {
    header("Location: /DSGN/login.html");
    exit();
}

if (isset($_SESSION['last_activity']) && (time() - $_SESSION['last_activity'] > $timeout)) {
    session_unset();
    session_destroy();
    header("Location: /DSGN/login.html");
    exit();
}

$_SESSION['last_activity'] = time();
?>