Forum Moderators: coopster
I got a login / logout script that resides on the same page. Basically if the URI includes action=logout I call a logout function that kills all the session variables. Otherwise I try to log in using the posted data, or do nothing if the form wasn't posted.
My problem is that I have somewhere on the page a small piece of code that says: 'You are logged in - <link>logout</link>'.
Now upon successful login this piece of code does not appear (until I refresh the page or navigate away from it) and similarly the piece of code still appears once I am logged out (until I refresh the page or navigate away from it).
Could anyone point me in the right direction to fix this, it's driving me nuts.
what you can do is to use header() to refresh the page on logout and login events then the message will be updated successfully.
a very hard subway could be to use javascript / ajax and put your this message in a div. check at the bottom / end of the page if the session value is alive or killed (Logged in or not) and then update the div value with javascript call.