/** * kill the current session * * This function deletes almost everything related to the current session, * except the cookie that contains the session id. * * @link http://fr.php.net/manual/en/function.session-destroy.php PHP: session_destroy */ public static function reset() { global $context; // if surfer has been authenticated if (Surfer::get_id()) { // erase presence information in his record $query = "UPDATE " . SQL::table_name('users') . " SET click_date='" . NULL_DATE . "', click_anchor=''" . " WHERE id = " . Surfer::get_id(); SQL::query($query, FALSE, $context['users_connection']); // also forget last visits include_once $context['path_to_root'] . 'users/visits.php'; Visits::purge_for_user(Surfer::get_id()); } // unset all of the session variables. $_SESSION = array(); // also delete permanent session cookie, if any if (isset($_COOKIE['screening'])) { Safe::setcookie('screening', '', time() - 3600, $context['url_to_root']); // also clear cookies used in leading index.php if ($home = getenv('YACS_HOME')) { Safe::setcookie('screening', '', time() - 3600, $home . '/'); } if ($context['url_to_root'] != '/') { Safe::setcookie('screening', '', time() - 3600, '/'); } } // finally, destroy the session and release related resources --no warning if session data cannot be deleted if (session_id() && is_callable('session_destroy')) { @session_destroy(); } }