Martin Laing - Multimedia Developer | Fife, Scotland

How to create simple Member Login for your websites. Part 3 - Logging Out Users

How to create simple Member Login for your websites. Part 3 - Logging Out Users

Part 3 - Logging out users

<?php
session_start();

// if the user is logged in, unset the session
if (isset($_SESSION['admin_loggedin'])) {
unset($_SESSION['admin_loggedin']);
}

// now that the user is logged out,
// go to login page
header('Location: index.php');
?>




All we do to logout the user is again start the session then we check to see if the user is logged in and if they are unset the session and redirect them back to the login page (index.php).


Part 2 - Managing Sessions
Back to the start

Comments

Comments will be displayed here

Back to Tutorial Home

Latest Projects

Fallen Angels Website Development Bucketball Candy Drop Fallen Angels Bebo Application Hector the Inspector

View Full Portfolio


Contact Me

If you would like to contact me, the easiest and quickest way to do so is by filling out the contact form on this website.

Send Me a Message

If you prefer you can contact me on any of these Websites:


Bebo facebook Myspace Twitter

Tutorials


How to send data from Flash to PHP How to create a Contact Form using PHP How to create simple Member Login for your websites. Part 1 - Member Login How to create simple Member Login for your websites. Part 2 - Session Management How to create simple Member Login for your websites. Part 3 - Logging Out Users