Rifts Posted November 9, 2010 Share Posted November 9, 2010 I have used sessions before I don't know whats going on. My sessions wont die. this is what im doing: <?php session_start(); $_SESSION['user'] = $_POST['email']; $_SESSION['pass'] = $_POST['pass']; ?> ok new page <?php session_start(); echo $_SESSION['user']; echo "<br>"; echo $_SESSION['pass'] ?> OK great is show the same info but now if I close my browser and go back to the second page where it echos it still shows the user//pass I have tried restarting and it still saves the dam session! Should it kill the session if i close my browser? wtf? Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 9, 2010 Share Posted November 9, 2010 It depends on the session.cookie_lifetime setting (assuming that you are passing the session id using a cookie) or if you are passing the session id on the end of the URL and you are using a URL that contains the session id when you revisit the second page after opening your browser. Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/#findComment-1132441 Share on other sites More sharing options...
Rifts Posted November 9, 2010 Author Share Posted November 9, 2010 I did phpinfo() and found this session.cookie_lifetime 0 0 so wtf lol? Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/#findComment-1132445 Share on other sites More sharing options...
ManiacDan Posted November 9, 2010 Share Posted November 9, 2010 Assuming you haven't overridden any settings, sessions are stored in a temporary file on your server's file system. The session file is named after the user's session ID, which is stored either (a) in the user's PHPSESSID cookie, or (b) in the URL. When the user visits the site, his cookie/URL are analyzed and the proper file is loaded into memory as $_SESSION. Check the URL you're using. If there's a 32-character hexadecimal code there that you don't recognize, it's your session ID, and anyone who uses that URL will get the same session as you. This is why URL-based sessions are frowned upon and rarely used. If there's no session ID in the URL, then you have a cookie called PHPSESSID on your browser. It SHOULD be deleted once all your browser windows are closed, but it won't necessarily. You'll have to delete the cookie by hand to clear your session. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/#findComment-1132448 Share on other sites More sharing options...
Rifts Posted November 9, 2010 Author Share Posted November 9, 2010 im using PHPSESSID and its still not deleting i have no idea why. this is very annoying Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/#findComment-1132450 Share on other sites More sharing options...
ManiacDan Posted November 9, 2010 Share Posted November 9, 2010 If you're not deleting the cookie or the URL parameter, the session won't go away. Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/#findComment-1132452 Share on other sites More sharing options...
Rifts Posted November 9, 2010 Author Share Posted November 9, 2010 well i fixed it and i dont understand why this worked... instead of setting the session like this: $_SESSION['user'] = $_POST['email']; I did $email = $_POST['email']; $_SESSION['user'] = $email and now everything works fine... weird huh? Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/#findComment-1132455 Share on other sites More sharing options...
ManiacDan Posted November 10, 2010 Share Posted November 10, 2010 That has no real effect...and you still haven't said whether or not you're deleting the cookies or URL params, but it's good that you think it's working now. Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/#findComment-1132632 Share on other sites More sharing options...
PFMaBiSmAd Posted November 10, 2010 Share Posted November 10, 2010 I'm thinking that enough time has gone by that a session id cookie that was set with some + life time value has now expired or that the session data file on the server was deleted by garbage collection. Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/#findComment-1132633 Share on other sites More sharing options...
Rifts Posted November 10, 2010 Author Share Posted November 10, 2010 I did not delete or change anything except what I posted and everything works fine now. Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/#findComment-1132707 Share on other sites More sharing options...
ManiacDan Posted November 10, 2010 Share Posted November 10, 2010 Right, so now it's the next day and the OS has deleted your data from yesterday. Try all your tests again. Code isn't magic, problems that go away on their own generally come back on their own. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/#findComment-1132709 Share on other sites More sharing options...
Rifts Posted November 10, 2010 Author Share Posted November 10, 2010 everything is working perfectly and that was the only change I made.. maybe it was storing the var. weird because of how my inculde pages are setup. idk Quote Link to comment https://forums.phpfreaks.com/topic/218244-my-computer-has-a-mind-of-its-own/#findComment-1132714 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.