<?
session_start();
session_regenerate_id();
$site_lang = substr($_SERVER["SCRIPT_NAME"], 1, 2);

if (isset($_SESSION['last_activity']) && (time() - $_SESSION['last_activity'] > 1800)) {
    // last request was more than 30 minutes ago
    session_unset();     // unset $_SESSION variable
    session_destroy();   // destroy session data
}
$_SESSION['last_activity'] = time(); // update last activity time stamp
?>