| re: Back Button Problem after Login Out
I think the back/refresh/forward issue is a typical problem with not only your log in issue, but also in calls to scripts that perform changes to databases (e.g. double submitting of posts to forums, etc.).
In my applications I use a nasty trick that my users are not particularly happy about, but have gotten used to. I save a counter as a variable in the $_SESSION array which is incremented by one each time a user accesses a page in the application. Also, for each page, I retrieve the current value of this counter and place it on the page as a hidden variable.
Then when the user submits for a new page, I compare the value of this counter stored in the $_SESSION variable to the value that is submitted in the $_POST variable, and if they do not match with each other, I know that the user has submitted a cached page using the refresh, back or forward buttons. And when this happens, I send the user to the application's start page, which is a safe page that does no database changes.
|