Thursday, 12 September 2013

PHP login requires refresh

PHP login requires refresh

I have a webpage that shows a login form depending on whether a cookie is
set. If the user logs in, the data is sent to a login script which sets
the cookie and returns the user back to the original page. The problem is,
for some reason, despite the cookie being set correctly (or deleted, in
the case of logout), the page continues showing the old content. A refresh
is required for the page to actually show the correct info. What's going
on?
My login script effectively does this:
setcookie("my_cookie",$userID, time()+3600*24*356, "/");
and my page checks this:
if (!isset($_COOKIE["my_cookie"]))
at the very top of the page.
Thanks for the help.

No comments:

Post a Comment