In my login script, if a user select 'remember me' it sets cookie like this:
setcookie("a", $valuea, time()+2595000, "/");
setcookie("b", $valueb, time()+2595000, "/");
and when a user (with 'remember me') select logout, the logout.php script unset cookie by the following way:
if(isset($_COOKIE['a']) && isset($_COOKIE['b'])){
setcookie("a","", time()-2595000, "/");
setcookie("b","", time()-2595000, "/");
setcookie(session_id(),"",time()-2595000, "/");
}
However, after logout the user is redirected to login page and login page checks the user login status by the following code:
if($_COOKIE['a']=='' || $_COOKIE['b']==''){
echo 'You are not logged in.';
}else{
echo 'You are logged in with remember me.Your cookie is: '.$_COOKIE['a'].' and '.$_COOKIE['b'];
}
But I found that user is not logged out and cookie is showing with value. I am not finding why the setcookie is not clearing the value of cookie a and b. Any idea?