I have a logout.php script and I want to put this code into it that asks the user if they are sure they want to logout.
echo "<center>Are you sure you want to logout?</center><br />";
echo "<center><a href=logout.php?logmeout>Yes</a> | <a href=javascript:history.back()>No</a>";
Heres my logout.php
<?php # Script 16.9 - logout.php
// This is the logout page for the site.
require_once ('includes/config.inc.php');
$page_title = 'Logout';
include ('includes/header.html');
// If no first_name session variable exists, redirect the user:
if (!isset($_SESSION['first_name'])) {
$url = BASE_URL . 'index.php'; // Define the URL.
ob_end_clean(); // Delete the buffer.
header("Location: $url");
exit(); // Quit the script.
} else { // Log out the user.
$_SESSION = array(); // Destroy the variables.
session_destroy(); // Destroy the session itself.
setcookie (session_name(), '', time()-300); // Destroy the cookie.
}
// Print a customized message:
echo '<h3>You are now logged out.</h3>';
include ('includes/footer.html');
?>