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:
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:
Post a Comment