HAN! Posted October 30, 2007 Share Posted October 30, 2007 i need logout the user by timeout while he is logeed in, is there any code i can write in my script to do this or i just have to change my php.ini, and how to change my php.ini? thanks Quote Link to comment Share on other sites More sharing options...
aschk Posted October 30, 2007 Share Posted October 30, 2007 Session timeout is determined by the settings in your php.ini file. However I believe there is a way to change the session timeout on a per domain basis (for virtual hosts). In PHP you can try ini_set("session.gc_maxlifetime", 60*60); The above sets the timeout to 1 hour. Quote Link to comment Share on other sites More sharing options...
kratsg Posted October 30, 2007 Share Posted October 30, 2007 If you can access the exact time the session was made... <?php $max_time_limit = "3600";//60 minutes $time_left = time() - $session_started; if($time_left >= $max_time_limit){ unset($_SESSION["username"]; unset($_SESSION["other_variable"]; //etc... } ?> Quote Link to comment 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.