blackcell Posted May 27, 2008 Share Posted May 27, 2008 Hello, I know that php sessions usually timeout with a set amount of inactivity. I have a simple login screen for a program that will data into session variables from a user-specific record in a database. The information is used throughout the program and is stored to reduce database access. I do a simple check function to ensure these session variables are set and contain the right data and if not, the program will die with a link to log back in. The thing that boggles my mind is we have 3 consistent users I have been gathering information from. One user says it only asks him to log back in if he is gone for 30 minutes or so (the way I think sessions are designed to act). The 2nd user says it is sporadic, sometimes logging him out and 5 minutes after logging in doing it again. Then sometimes his sessions lasts all day. The 3rd user(me) can go for like 3 days without ever logging me out. At night the program will sit on one page and go nowhere until the next morining. Then about once ever 2 weeks it will log me out in the middle of working. By the way, I have no script that does logout on time idle or anything of that nature. (With the exception of checking to make sure they are set). Link to comment https://forums.phpfreaks.com/topic/107455-sessions-time-out/ Share on other sites More sharing options...
kev wood Posted May 27, 2008 Share Posted May 27, 2008 try putting this at the top of your pages. test it on only at first save editing all the pages set_time_limit(108000); this code should time the session out after 30mins with the time in seconds. if you dont want it to time out simply put a 0 in the () Link to comment https://forums.phpfreaks.com/topic/107455-sessions-time-out/#findComment-550783 Share on other sites More sharing options...
blackcell Posted May 27, 2008 Author Share Posted May 27, 2008 Ok, Ill try that thanks. Link to comment https://forums.phpfreaks.com/topic/107455-sessions-time-out/#findComment-550789 Share on other sites More sharing options...
blackcell Posted May 27, 2008 Author Share Posted May 27, 2008 Well something is fishy because I set the timeout to 60 and it won't kill the session. I have a global include file that I include at the beginning of every page. I drop includes into this file so I don't have to include on every single page. This global include file is where I session_start(); and just now set_time_limit(60); and it won't kick me off after being idle for upwards of 3 minutes. Link to comment https://forums.phpfreaks.com/topic/107455-sessions-time-out/#findComment-550792 Share on other sites More sharing options...
kev wood Posted May 27, 2008 Share Posted May 27, 2008 try it with ot instead of limit that should fix it the one i gave you earlier was for the amount of time you would give your script to run sorry mate. if that dont work take a look at this link it is a more long winded way of doing it. http://www.weberdev.com/get_example-4267.html Link to comment https://forums.phpfreaks.com/topic/107455-sessions-time-out/#findComment-550954 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.