The code... ['logout.php']
<?
if (isset($_COOKIE['Username'])) {
unset($_COOKIE['Username']);
echo "You have now been logged out!";
} else {
echo "You need to be logged in to logout!";
}
?>
When I go to that webpage, the script checks if a cookie is set, which it is. When I first visit that page, I get a "You have now been logged out!" message, which I should expect. The thing that is getting to me is when I go to the page, for the second time. When I do this, I get the same message, as I did before. Shouldn't I get a "You need to be logged in to logout!" message, because on the first page visit, the cookie was set and that triggered off a section of code to expire the cookie. Could any one please tell me why I keep getting the "else' message, even though the cookie is unset?