Hi All,
In a nutshell, a user logs in. When they do so, a session username, password, and department are set. This holds true, for those values are reflected and appear in my session text file.
When a user is logged in, they should be able to access all admin. pages hastle-free...Otherwise, they'll be reverted to a login page...
Here's the deal during testing: When I go to log a user out, control is bouncing back to the login page...Really, what's supposed to happen is this: It will check if the session variables have been set. If they have, they will be unset, and the session will be destroyed. But this isn't happening...For some reason out of the unknown, it's not recognizing those session vars. which have been saved in my text file...What's going on here??
My code is as follows. A user is logged in, so those variabels should be available to all session enabled pages...Why is it not accepting those vars. ??? TIA, Mike
<?if ( (session_is_registered('username')) AND (session_is_registered('password')) AND (session_is_registered('department')) ){//start the session
session_start();
// Unset the session variables
unset($_SESSION['username']);
unset($_SESSION['password']);
unset($_SESSION['department']);
// Destroy the session
session_destroy();
}
else
{
header ("Location:dhl.htm");
}
?>
Remember, a user will only be able to see this page if they officially log out of administration. If a user just typed the URL for this page into their browser, I do not want it to set a session...That's why I did not put session_start() as the first thing on the page...
We have to check first if session vars. exist. If they do, start a session, unregister vars, and destroy them.
Thanks for everyone's help!