L Posted September 28, 2007 Share Posted September 28, 2007 Hey everybody, With school I've been quite busy; thus, my absence from the forums. But I am here, on my free time, with a question. I log in fine, and surf my website, go to other ones, but when I come back I'm logged out. Now I'm thinking I didn't set my session right correctly. I check back and they seem fine. So I log in again, reload my webpage a couple of times, and then I "log out". This means that when I refreshed the login inputs show up. This is bad because I have those show up if a person is not logged in(meaning the sessions aren't set). This means that the sessions are either being destroyed, or aren't being set right. But the last option is that my host is messed up, because I have the same thing running at another host and it works fine. Any thoughts, solutions? Thank you for your time ~L Quote Link to comment https://forums.phpfreaks.com/topic/71022-session-randomly-being-destroyed/ Share on other sites More sharing options...
rarebit Posted September 28, 2007 Share Posted September 28, 2007 Are you using session cookies or using PHPSESSID method? Quote Link to comment https://forums.phpfreaks.com/topic/71022-session-randomly-being-destroyed/#findComment-357110 Share on other sites More sharing options...
L Posted September 28, 2007 Author Share Posted September 28, 2007 session_start(); $_SESSION['userid'] so I'm guessing session cookies...but not PHPSESSID Quote Link to comment https://forums.phpfreaks.com/topic/71022-session-randomly-being-destroyed/#findComment-357114 Share on other sites More sharing options...
rarebit Posted September 28, 2007 Share Posted September 28, 2007 As you say... 2 possible reasons: 1. Check php.ini to find out length of session, 'cookie_lifetime' should be set to '0' for 'until browser closed'. 2. Do a grep for 'session_destroy', 'session_unregister', 'session_unset', 'session_write_close', ... there are other ways you may change or reset the session, but these are the more probable. Especially the unset, thinking your just getting rid of vars, e.g. Do NOT unset the whole $_SESSION with unset($_SESSION) as this will disable the registering of session variables through the $_SESSION superglobal. Quote Link to comment https://forums.phpfreaks.com/topic/71022-session-randomly-being-destroyed/#findComment-357120 Share on other sites More sharing options...
L Posted September 28, 2007 Author Share Posted September 28, 2007 ok, I searched my files and the only time I have unset() is on the logout page(which I didn't go to when I got logged out!) for the first option, where is this php.ini file? I've been searching and I can't seem to find it, Thanx ~L Quote Link to comment https://forums.phpfreaks.com/topic/71022-session-randomly-being-destroyed/#findComment-357126 Share on other sites More sharing options...
rarebit Posted September 28, 2007 Share Posted September 28, 2007 If you use a host then you'll probably not have access to it. You can view it by making a php page such as: <?php echo phpinfo(); ?> Here's some refs for handling from php: http://uk3.php.net/manual/en/function.phpinfo.php http://uk3.php.net/manual/en/function.ini-get.php http://uk3.php.net/manual/en/function.ini-set.php Quote Link to comment https://forums.phpfreaks.com/topic/71022-session-randomly-being-destroyed/#findComment-357132 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.