Hi all, I have a very simple login script, which in spite of its simplicity I can't get to work... My login code: <?php $bruger = $_POST['username']; setcookie('member',$bruger); ?> Code (markup): My log out code: setcookie('member', time()-3600); Code (markup): Problem is that I can't destroy the cookie, thereby logging the user out... Could anyone please help me here? Thanks.
The syntax for setcookie is; setcookie ( string $name [, string $value [, int $expire [, string $path [, string $domain [, bool $secure [, bool $httponly ]]]]]] ) so it should be setcookie('member', '', time()-3600); to log a user out.
Hi iDemonix THanks for your reply. Unfortunately it doesn't seem to work. The cookie is still set, and the user logged in
Try This: i think problem is in ur login script so try this login script Login Script: setcookie('member', $bruger, time() + 3600); Code (markup): Logout Script: setcookie("member", "", time() - 3600 , '/'); Code (markup):