Reputation: 588
My problem cookie is not unset() properly.
Here is my code
$expire=time()+(60*60*24*7);
setcookie('ppt-superadmin',$user['login_id'],$expire,"/",$baseurl)
here $baseurl="http://localhost/demo/
This is working fine. And here is my logout.php code
session_start();
$expire=time()-(60*60*24*7);
unset($_SESSION['ppt-superadmin-login']);
setcookie('ppt_superadmin',"",$expire,"/",$baseurl);
unset($_COOKIE['ppt-superadmin']);
session_destroy();
I have tried both unset and setcookie() to a past time. BUt not working. I have echo its value, its showing value set at the time of login. What is the problem here??
Upvotes: 0
Views: 69
Reputation: 26421
I guess you have a a typo,
setcookie('ppt_superadmin',"",$expire,"/",$baseurl);
^
Make sure it's underscore or dash because at time of setting you have name with dash while at time of un-setting it, you used underscore.
Upvotes: 1