Translate

Friday, 4 May 2012

Step 7: Creating the logout.php file

Step 7: Creating the logout.php file
The logout file will destroy the session and it’s stored information. Afterwards it will redirect the user to the homepage.

File logout.php:
<?php
session_start();
if( session_unregister('loginid') == true && session_unregister('username')==true ) {
        session_destroy();
        header('Location: index.php');
  } else {
   unset($_SESSION['loginid']);
   unset($_SESSION['username']);
   session_destroy();
   header('Location: index.php');
}
?>

No comments: