Cookies are not removing on Log Out
<p>I've got a problem, user can't Log Out because the $_COOKIE's are not actually deleting. I can't find out what could be the problem.</p>

<p>This code is used only once at Log In:</p>

<pre><code>// Log In
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['username'] = $row['username'];
setcookie('user_id', $row['user_id'], time() + 2592000);
setcookie('username', $row['username'], time() + 2592000);
</code></pre>

<p>The code below is checking if cookies are set up to make users to be logged in when they relaunch their browser (the "keep me logged in" effect).</p>

<pre><code>// Starting Session
session_start();
// If the session vars aren't set, try to set them with cookies
if (!isset($_SESSION['user_id'])) {
    // This check always equals true because cookies are not deleting on Log Out
    if (isset($_COOKIE['user_id']) &amp;&amp; isset($_COOKIE['username'])) {
        $_SESSION['user_id'] = $_COOKIE['user_id'];
        $_SESSION['username'] = $_COOKIE['username'];
    }
}
</code></pre>

<p>This code is launched only once on Log Out:</p>

<pre><code>// Log Out
session_start();
if (isset($_SESSION['user_id'])) {
    $_SESSION = array();
    if (isset($_COOKIE[session_name()])) {
        setcookie(session_name(), '', time() - 2592000, '/');
    }
    session_destroy();
}
setcookie('user_id', '', time() - 2592000);
setcookie('username', '', time() - 2592000);
</code></pre>
