I set a cookie to delete as the user presses the logout link:
if(isset($_GET['logout']))
{
setCookie("user",'',time()-(60*60*24*365*5));
echo "deleted cookie";
}
When I click logout, I get the writing deleted cookie,.. when I launch the browser again, my logged in screen appears, even thought it shouldnt cause the cookie was deleted.. Why does that happen?
Edit: The original setcookie() call:
setCookie("user",$password_hash,time()+60*60*24*365*5,"/");
I even do this:
setCookie("user",'',time()-(60*60*24*365*5));
echo "deleted cookie";
echo $_COOKIE["user"];
The cookie still gets printed
Since you specified the path as
"/"in the originalsetcookie()call, send the same path statement in your unset call: