function logout() { destroySessions(); if (hasCookie()) { destroyCookie(); } //send to login page header("Location: " . LOGIN_PAGE); }
<?php ob_start(); session_start(); include 'login_functions.php'; destroyCookie(); $_SESSION = array(); //destroy all of the session variables session_destroy(); header('Location: index.php'); ob_flush();