Location: PHPKode > projects > phpautotest > logout.php
<?php
session_start();

require 'includes/phpautotest_config.php';
require 'includes/phpautotest_functions.php';

if($_COOKIE['logged_in'] == 1)//if(isset($_SESSION['logged_in']))
{
	setcookie('logged_in', 0);
	
	// The change in $_COOKIE['logged_in'] is effective from the next page, so for this page to know the change we unset the variable (it will be re-created automatically)
	unset($_COOKIE['logged_in']);
	
	// Unset all the $_SESSION variables
	$_SESSION = array();

	// Destroy the session
	session_destroy();
	
	phpautotest_show_message($phpautotest_message['logout_success']);
}
else
{
	phpautotest_show_error($phpautotest_message['logout_failure']);
}

require('includes/footer.php');
?>
Return current item: phpautotest