PDA

View Full Version : Logout does not clear cookies


manfred
07-12-2004, 02:16 PM
I can't log out with this new cookie based authoring system. When logout is clicked it just refresh the index.page and that's all.

Session based works OK.

WinXP, Apache 2.0.50, PHP5.0RC2 in use

M

Charter
07-12-2004, 02:25 PM
Hi. Maybe a cache issue... what if you refresh?

manfred
07-12-2004, 02:32 PM
Done that but still at admin page. Is there any special settings in php.ini or apache config file for cookies?

Or this can be a bug in PHP5RC2

M

Charter
07-12-2004, 02:35 PM
Don't know if it's related to PHP5RC2 or not?

Try sticking all this at the top of admin/index.php and see if it takes:

// prevent caching code from php.net
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0

manfred
07-12-2004, 02:43 PM
Didn't help, also tried with PHP5RC1. I will study this further tomorrow with latest PHP version. Strange that I'm the only one having this problem.

M

Charter
07-12-2004, 02:52 PM
In logout.php change:

setcookie("phpdigadmin", "", time()-3600);

to the following:

setcookie("phpdigadmin", "", time()-3600, "/");

Did it help?

manfred
07-12-2004, 02:58 PM
Thanks, now it works. Also in php.net they think this is better way to clear cookies.



setcookie("phpdigadmin", "", mktime(12,0,0,1, 1, 1970), "/");

M