Unset cookies php

I have this code that setted when login check is fine:

if((isset($_POST["remember_me"]))&&($_POST["remember_me"]==1))
    {
    setcookie('email', $username, time()+3600);
    setcookie('pass', $pass, time()+3600);
    }

Now, when I click on logout link (logout.php) i did this:

<?php session_start();
setcookie("email", '', 1, "");
setcookie("pass", '', 1, "");
$_SESSION["login"] = "";
header("location: aforum/enter_furom.php");
?>

I didn’t use destroy session because I don’t want to destroy all sessions…. now destroying a session is working fine… but when I try to unset cookies, the browsers (all browsers: explorer, chrome, firefox, mozilla) give me an error saying that the new cookies cant be setted…any help to unset the above cookies ?

Leave a Comment