Forum Moderators: coopster

Message Too Old, No Replies

Cant seem to delete session cookie

         

FiRe

4:00 pm on May 11, 2007 (gmt 0)

10+ Year Member



I set a cookie for a session (not actually using sessions) like this:

setcookie('lgusr', $id, 0);

Now when you click logout it won't destroy the cookie unless you close the browser. I have tried session_destory and also:

setcookie('lgusr', '', -1);

As was suggested in the php manual but the cookie remains! Any ideas?

jatar_k

4:47 pm on May 11, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



is it just the cookie still there or can they still access the logged in session?

eelixduppy

10:26 pm on May 11, 2007 (gmt 0)



Try something like this:

setcookie('lgusr', 0, time()-100);

I don't think -1 will work correctly. You should be able to unset() it, too.

FiRe

6:33 pm on May 12, 2007 (gmt 0)

10+ Year Member



Tried this:

<?php
setcookie('lgusr', 0, time()-100);
unset($_COOKIE['lgusr']);
header ("Location: ../index.php");
?>

But no effect, the cookie still appears in the browser :-S

henry0

9:08 pm on May 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you try to restart? Using IE I suppose.