Hi all,
Could someone please tell me what is wrong with this code??
<?php
session_start();
$old_user = $HTTP_SESSION_VARS['valid_user']; // store to test if were logged in
unset($HTTP_SESSION_VARS);
$result_dest = session_destroy();
echo '<h1>Logging Out</h1>';
if (!empty($old_user))
{
if ($result_dest)
{
// if they were logged in and are now logged out
echo 'Logged out.<br />
<a href="testmail.htm">Back to log in page</a>';
}
else
{
// They were logged in and could not be logged out
echo 'Could not log you out.<br />';
}
}
else
{
// if they were not logged in but came to this page somehow
echo 'You were not logged in.<br />
<a href="testmail.htm">Back to log in page</a>';
}
?>
The problem is I always get the final else clause...'You were not logged in'
I have created a main html page which contains the login box. That takes me to admin.php.
On this page is text and a LOGOUT link.
However, when I press LOGOUT I always get the final else clause.
Please help.
Thank you,
Kevin.