<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
include_once ($_SERVER['DOCUMENT_ROOT'] . '/_config/functions.php');
spl_autoload_register('my_autoload');
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . '/Auth/chk.auth.php');

security::logout();

$_SESSION                             = array();
if (ini_get("session.use_cookies")) {
    $params                           = session_get_cookie_params();
    setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"]);
}

if (isset($_COOKIE['identifier'])) {
  unset($_COOKIE['identifier']);
  unset($_COOKIE['sectoken']);
  unset($_COOKIE['hostIP']);
  setcookie('identifier', null, -1, '/');
  setcookie('sectoken', null, -1, '/');
  setcookie('hostIP', null, -1, '/');
}
session_destroy();

echo '<meta http-equiv="refresh" content="0; URL=/">';
