rofl90 Posted March 8, 2008 Share Posted March 8, 2008 Is this a good idea instead of fumbling around with php.ini could you tell me the drawbacks if their is any: <meta http-equiv='refresh' content='[mysqlqueryfortimeout];logout.php' /> Quote Link to comment https://forums.phpfreaks.com/topic/95036-session-expiry/ Share on other sites More sharing options...
corbin Posted March 8, 2008 Share Posted March 8, 2008 Errr assuming your session stuff is stored in a mysql table? What exactly are you trying to do? Are you trying to make the session expire after X seconds? Are you trying to make the user go to a certain page after sitting inactive on a page for X seconds? Or what? Quote Link to comment https://forums.phpfreaks.com/topic/95036-session-expiry/#findComment-486818 Share on other sites More sharing options...
rofl90 Posted March 8, 2008 Author Share Posted March 8, 2008 the latter of your questions Quote Link to comment https://forums.phpfreaks.com/topic/95036-session-expiry/#findComment-486826 Share on other sites More sharing options...
corbin Posted March 8, 2008 Share Posted March 8, 2008 <meta http-equiv='refresh' content='x;somewhere.php' /> [/quote] Where x is the seconds would send a user to somewhere.php x seconds after the page loaded. If you're trying to log the user out after x seconds, that's a different story though. You would need to expire the session. Also, never trust anything client side. A browser could easily ignore that meta tag and leave the client at that page. If you're trying to make people logout after idle time, make their session expire or something, and then redirct the page. Don't try to log them out by redirecting the page. Just of curiosity, what's the purpose of this? I might be able to answer better then, because I'm still not 100% what you're tryng to accomplish.... (02:19 might just be having a slow moment x.x.) Quote Link to comment https://forums.phpfreaks.com/topic/95036-session-expiry/#findComment-486827 Share on other sites More sharing options...
rofl90 Posted March 8, 2008 Author Share Posted March 8, 2008 lol at the last bit, I'm trying to gain more control over users, by saying if your idle for x minutes you will be logged out, logout.php contains the session deleting stuff, is there a way to check on the time in php as like a meta tag almost a countdown? Quote Link to comment https://forums.phpfreaks.com/topic/95036-session-expiry/#findComment-486830 Share on other sites More sharing options...
laffin Posted March 8, 2008 Share Posted March 8, 2008 use a session with the timeout period Upon successful login $_SESSION['timeout']=time()+15*60; // 15 minute timeout than when u load a page check this timeout if($_SESSION['timeout']<time()) { header("Location: login.php"); // If user timed out, send em back to loginpage session_destroy(); // Also remove his session variables; // remove any other Cookies or settings exit; } $_SESSION['timeout']=time()+15*60; // Give User another 15 minutes Quote Link to comment https://forums.phpfreaks.com/topic/95036-session-expiry/#findComment-486842 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.