By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

PHP Session problem

P: 51
How to maintain a session from page to page? I'm getting a problem here when i try to logout, the session is destroy but i still can go inside to that page without login first by using IE Back button or history cache! How can i solve that? Anybody help me please...
Feb 21 '07 #1
Share this Question
Share on Google+
5 Replies


Motoma
Expert 2.5K+
P: 3,235
How to maintain a session from page to page? I'm getting a problem here when i try to logout, the session is destroy but i still can go inside to that page without login first by using IE Back button or history cache! How can i solve that? Anybody help me please...
Welcome to theScripts.

You may have to specify that the page not be cached, and make sure that you not only destroy the session, but clear the $_SESSION array:
[PHP]
$_SESSION = array();
[/PHP]
Feb 21 '07 #2

P: 51
Thanks Motoma for reply! But how can you show that will be running? Can you give me some explanation. Regard!
Feb 21 '07 #3

Motoma
Expert 2.5K+
P: 3,235
Thanks Motoma for reply! But how can you show that will be running? Can you give me some explanation. Regard!
The no cache part of my previous post is demonstrated quite well here.
Feb 21 '07 #4

P: 51
i would like to give some example here, simply even for this forum if you logout from your accout you still can be go to your site withuot enter a user name and password by click Back botton! There is a dangerious that other people can threat badly inside your accout! Regard...
Feb 21 '07 #5

Motoma
Expert 2.5K+
P: 3,235
i would like to give some example here, simply even for this forum if you logout from your accout you still can be go to your site withuot enter a user name and password by click Back botton! There is a dangerious that other people can threat badly inside your accout! Regard...
This is called caching. Browsers do this to save on bandwidth.
If you log out from this site, and then hit the back button you can stil see a page but that's okay...If you try to continue on to another page after you log out, you are told to log back in again.
Feb 21 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.