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??
display_errorsturned on? Always when developing codeerror_reporting(E_ALL); ini_set('display_errors', 1);-- header errors are extremely common with cookie problems. Also, where did you check the unset cookie's value? Was it in the same script? You will not see it unset until a subsequent HTTP request. Best to inspect the cookie with your browser's developer tools rather than look at its value in PHP. - Michael Berkowski$baseurlshould be a domainlocalhost, not a URLhttp://localhost/...- Michael Berkowskitime()-1But why use a cookie, if you have a session? - Elias Van Ootegem