<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 * Tutorial: PHP Login Registration system
 *
 * Page : Logout
 */
 
// start session
session_start();
 
// Destroy user session
unset($_SESSION['uid']);
unset($_SESSION['csrf_token']);
unset($_SESSION['csrf_token_time']);
unset($_SESSION['LAST_ACTIVITY']);

 
// Redirect to index.php page


// Preserve the timeout flag when redirecting
if (isset($_GET['timeout']) && $_GET['timeout'] == '1') {
    header("Location: index.php?timeout=1");
} else {
    header("Location: index.php");
}

?>
