There are a lot of posts about that issue, nevertheless I'm unable to fix it. I try to delete a cookie in order to logoff the user in PHP and do a redirect afterwards:
    $currentCookieParams = session_get_cookie_params(); 
    session_set_cookie_params($currentCookieParams['lifetime'], '/', $currentCookieParams['domain'], $currentCookieParams['secure'], true);
    session_name("PHPAUTH");
    session_start();
    $_SESSION = array();
    if (ini_get("session.use_cookies"))
    {
        $params = session_get_cookie_params();
        setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
    }
    session_destroy();          
    header("Location: http://localhost/Home/Index");
    exit;
But the cookie is still there. When I disable the redirect, the cookie is deleted successfully. But with the redirect, the cookie isn't deleted anyway.
How can I ensure that the cookie is deleted with the redirect afterwards?
EDIT:
It seems my own code recreated the cookie in the next request. I want to check whether the user is still logged on and if not redirect to the login page:
        $currentCookieParams = session_get_cookie_params(); 
        session_set_cookie_params($currentCookieParams['lifetime'], '/', $currentCookieParams['domain'], $currentCookieParams['secure'], true);
        session_name("PHPAUTH");
        session_start();     
        if (!array_key_exists('angemeldet', $_SESSION) || !$_SESSION['angemeldet'])
        {
            header("Location: http://localhost/Account/LogOn");
            exit;
        }
How can I check this without recreating the cookie? Maybe a stupid question, but I'm quite confused at the moment...