Jump to content

[SOLVED] unsetting cookie does not work


evanct

Recommended Posts

So when user logs in, cookie is set in loggedin.php:

 

<?php
$id=$_GET['id'];
setcookie('login',$id,time()+7200,'/');
header('location:index.php');

?>

 

Then when the user logs out, as part of the logout function(which otherwise works) the cookie is allegedly unset:

 

setcookie ('login', '', time() - 7200);

 

It then redirects to index.php, where if $_COOKIE['login'] is not set it will redirect to login.php. it doesn't redirect. print_r($_COOKIE) reveals that $_COOKIE['login'] is in fact still set to the value it was set to in loggedin.php.

 

What's going on?

Link to comment
https://forums.phpfreaks.com/topic/161012-solved-unsetting-cookie-does-not-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.