I'm working on a user system, it uses cookies and session data combined.
I'm working on the logout part.
This is the function that came with the script (it's from a tutorial, I've modded most of it a bit and such).
//Destroy all sessions and cookies
function logout()
{
session_destroy();
setcookie('username', $username, time()-15000);
setcookie('password', $password, time()-15000);
return true;
}
$username and $password are given by session data and such using a user_data() function and such.
When the login script it pointed to the action of logout, it simply calls this function.
When I access the page, I then look in my cookies, and they are still there with the full data (username, full md5 hashed password). I also go to any pages such as the admin control panel (which is non-accessible with anyone without authorization level clearence), they let me in without question.
Not a fault with the authentication, if I remove them manually, they work fine.
Some reason it seems this just isn't erasing the cookies. I've ensured the function is working, by putting it in an if statement, and having it return false.
I've tried using the $_COOKIE variables and setting them to '' or FALSE, to no avail. Tried setting the cokies above as FALSE and '' strings; no avail.
I know it isn't a header issue, as I have ob_start on my index page, and even if that were an issue, setcookie() would return FALSE and kill the function with an error of some sort, as I have tested with more if statements.
I also used print_r() and it gives me the following.
Array ( [PHPSESSID] => *session data censored* [cprelogin] => no [username] => [password] => )What the heck?
I've doublechecked all my Firefox settings, and they are set to respect the expiration date and stuff, but the cookies still exist on my hard drive.
Any ideas? Here's the page by the way.
I'll set up a dummy user for anyone who would be so kind as to test for themselves and see if it's just me. User and pass are both 'test'. Once you've logged in, try and logout, then go back to the login page (link will be under the logged out text).
Edited by Demonslay, 30 August 2006 - 09:20 PM.
