I am creating a multiuser website that has a login script to verify users' passwords and login name. When a user successfully logs in, the session_start() is called and also a cookie is set that expires in 2 weeks or so so that the user doesn't always have to login. this all works fine. after logging in, the user is redirected to the index page. The problem comes when logging out. If a user wants to log out and erase the cookie before 2 weeks, he clicks 'logout' and is sent to login.php?logout=1 which calls session_destroy() and setcoookie("cookiename", "", time()-3600). header() is then called to reload the login page so that they can re-login if they want. the problem is is that after the cookie is set to expite and the session is destroyed the first reload of login.php says the user is still logged in. Another reload of login.php and the user is not logged in. Why would I have to reload a page twice for cookies to be erased? Any suggestions?
Thanks
Jon Buda