Script 18.9
Test Application - User Registration
You need to log in before you can be logged out!
<?php # Script 18.9 - logout.php // This is the logout page for the site. require (CHAPTER_PATH.'/'.$chapter.'/includes/18.3.php'); $page_title = 'Logout'; // If logged in, log out and redirect the user: if (isset($_SESSION['first_name']) && !isset($_GET['status'])) { //log out user $_SESSION = array(); // Destroy the variables. session_destroy(); // Destroy the session itself. setcookie (session_name(), '', time()-3600); // Destroy the cookie. require (CHAPTER_PATH.'/12/includes/12.2.php'); ob_end_clean(); // Delete the buffer. redirect_user('index.php?chapter=18&script=18.9&status=loggedout'); } else { include (CHAPTER_PATH.'/'.$chapter.'/includes/18.1.php'); if(isset($_GET['status']) && $_GET['status']=='loggedout'){ //confirm log out echo "<h1>Logged Out</h1> <p>Thanks for visiting. You are now logged out of our system.</p>"; } else { echo '<p class="error">You need to log in before you can be logged out!</p> <p><a href="index.php?chapter=18&script=18.8" title="Log In">Log in</a></p>'; } include (CHAPTER_PATH.'/'.$chapter.'/includes/18.2.php'); } ?>