Jump to content

PHP Session problem only on one page throughout the website


Recommended Posts

This problem is for real PHP freaks. I do not post in forums unless I really can't find a solution. I have been bugged by this for days now.

Here it is.


I have a page signup.php among other pages on the website. Once you logout from logout.php all session is destroyed and all cookies are deleted.

you can visit the website as a visitor after logging out. I visited all pages to make sure I was really logged out.

Everything is normal up till here. However, when I click on signup again which call signup.php, the old session becomes suddenly alive and you are logged in again as if you had never logged out. I have never faced this problem before and I have made many websites using PHP. 


I have tested and found that session is already there when the page loads and values are not formed by any variable or function manipulation.


I am using hostgator shared hosting.


Please guyz help me out. I am not sure what I am doing wrong here.

Link to comment
Share on other sites

we cannot really help you without the code that reproduces the problem, to pin down the many different possibilities to just the one that is actually causing the problem. by seeing what your code is doing (redirecting, including, setting/testing variables/cookies, trying - successful or not - to remove cookies), lets us know which direction to look.


best guess is you actually have two different sessions, due to different host-names (www. vs no-www.) in the URL's and the session cookie domain setting is only matching the host-name where the session was created and you are visiting the signup page using a different host-name from where the session was destroyed at and you are seeing the second session data. second best guess, you are passing the session id in the url (intentionally/unintentionally) and resuming the session (are you also destroying the session data file?)

Link to comment
Share on other sites

so you used session_destroy() and you destroyed your session cookie name (time()-x)?


Can you echo the session variables after you logout?


Can you post your logout code?


Are you using ie?


Not that I'm talking bad about ie but believe it or not I had something like this happen a few months ago, I looked at it for hours, I restarted my machine and I guess ie reloaded correctly and it work from then on.

Edited by floridaflatlander
Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.