acctman Posted July 24, 2008 Share Posted July 24, 2008 Can someone direct me with some example code, that will keep a user logged into a website till he/she closes the browser. Link to comment https://forums.phpfreaks.com/topic/116473-keep-user-logged-in-till-browser-is-closed/ Share on other sites More sharing options...
NorthWestSimulations Posted July 24, 2008 Share Posted July 24, 2008 <?php session_start(); $_SESSION['loggin_in'] = "Yes"; $_SESSION['username'] = $_POST['username']; ?> Sessions keep users info logged till the browser is closed. Hope this helps. Link to comment https://forums.phpfreaks.com/topic/116473-keep-user-logged-in-till-browser-is-closed/#findComment-598961 Share on other sites More sharing options...
revraz Posted July 24, 2008 Share Posted July 24, 2008 Well they also have a inactivity timeout, so you would have to specify a longer time in the php.ini for the session to stay alive and not get cleaned by the GC. Link to comment https://forums.phpfreaks.com/topic/116473-keep-user-logged-in-till-browser-is-closed/#findComment-598963 Share on other sites More sharing options...
NorthWestSimulations Posted July 24, 2008 Share Posted July 24, 2008 quiet possibly he could use an ini_set(); so in case he doesnt have ini rewrite 777 permissions Link to comment https://forums.phpfreaks.com/topic/116473-keep-user-logged-in-till-browser-is-closed/#findComment-598966 Share on other sites More sharing options...
acctman Posted July 24, 2008 Author Share Posted July 24, 2008 quiet possibly he could use an ini_set(); so in case he doesnt have ini rewrite 777 permissions ini_set() ?... an example is myspace, i believe a user stays logged in till they close the browser. so even if there is no activity for 10hrs you can still go back access your page without having to log back in. As long as the browser window isn't closed. a cookie on the users side would be nice, so the server doesn't have to use any resources keeping time limits on all the users. Link to comment https://forums.phpfreaks.com/topic/116473-keep-user-logged-in-till-browser-is-closed/#findComment-599049 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.