logout.php (539B)
1 <?php 2 # The recommended way to destroy a session, from php.net 3 4 session_start(); 5 6 # Remove session variables with empty array 7 $_SESSION = array(); 8 9 # Get session cookie 10 if (ini_get('session.use_cookies')) { 11 # Remove session and session data 12 $params = session_get_cookie_params(); 13 setcookie(session_name(), '', time() - 42000, 14 $params['path'], $params['domain'], 15 $params['secure'], $params['httponly'] 16 ); 17 } 18 19 # Destroy session 20 session_destroy(); 21 ?>