php - I'm trying session expire when compter goes aftersleep mode -
I am trying to end the session when the computer goes to sleep mode after 1min. How do I implement it?
& lt ;? Include php ('config.php'); Session_start (); $ Myusername = $ _ session ['myusername']; $ Ses_sql = mysql_query ( "Select nocname from nocusers where nocname = '$ myusername' '); $ row = mysql_fetch_array ($ ses_sql); $ Login_session = $ row [' nocname ']; if (! Isset ($ login_session)) { header ( "location: login.php");}? & Gt;
the first you'll need your address change Taimtaim 1 min = 60 such seconds ini_set ( 'session.gc_maxlifetime', 60); While loading, you can now see the session value each time. If the activity is not within 1 minute session, then it will end and you will Logout to the
& lt ;? Php include ( 'config.php'); session_start (for); if (isset ($ _ SESSION [ 'myusername'])) {$ myusername = $ _ sESSION [ 'myusername']; $ Ses_sql = mysql_query ( "Select nocname from nocusers where nocname = '$ myusername' LIMIT 1); If ($ row = mysql_fetch_array ($ ses_sql)) {$ _SESSION [ 'myusername'] = $ row [ 'nocname']; } Else {// logout here}} else {// logout here}? & Gt; Update 2: You can also store the last activity in your database in relation to each user. And update it at the top of each page. Before it checks that the last updated time is less than 1 minute, yes, this means that there is no activity of this user for more than 1 minute. Log it out.
Comments
Post a Comment