CBaZ Posted August 2, 2007 Share Posted August 2, 2007 I have a timer and it times out is there anyway that i can make that timer give the user a window to extend the timer to stay signed on. because everytime it times out the user is no longer signed in on the system so some of the features I am afraid stop working. timer in question is below. thanks <?php include("dbinfo.php"); // Set length of session to twenty minutes define("SESSION_LENGTH", 20); $sConn = @mysql_connect($dbServer, $dbUser, $dbPass) or die("Couldnt connect to database"); $dbConn = @mysql_select_db($dbName, $sConn) or die("Couldnt select database $dbName"); $timeMax = time() - (60* SESSION_LENGTH); $result = mysql_query("select count(*) from usersOnline where unix_timestamp(dateAdded) >= '$timeMax' and permission = '0'"); $usersOnline = mysql_result($result, 0, 0); $resulta = mysql_query("select count(*) from usersOnline where unix_timestamp(dateAdded) >= '$timeMax' and permission = '1'"); $usersOnline2 = mysql_result($resulta, 0, 0); $resultb = mysql_query("select count(*) from usersOnline where unix_timestamp(dateAdded) >= '$timeMax' and permission = '2'"); $usersOnline3 = mysql_result($resultb, 0, 0); $connect = mysql_connect("localhost", "user", "pass") or die("Could not connect to database: " . mysql_error()); mysql_select_db("db", $connect) or die("Could not select database"); $result3 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '0'"); $row = mysql_fetch_array($result3); $result4 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '1'"); $row2 = mysql_fetch_array($result4); echo "" . ($usersOnline2 != 1 ? "" : "") . " $usersOnline2 Admin" . ($usersOnline2 != 1 ? "s" : "") ." of $row2[count]. ". " </br> ". ($usersOnline3 != 1 ? "" : "") . " $usersOnline3 Guest" . ($usersOnline3 != 1 ? "s" : "") ."." . " </br> " . ($usersOnline != 1 ? "" : "") . " $usersOnline User" . ($usersOnline != 1 ? "s" : "") ." of $row[count]" . ". "; ?> Quote Link to comment https://forums.phpfreaks.com/topic/62981-users-online-question/ Share on other sites More sharing options...
btherl Posted August 2, 2007 Share Posted August 2, 2007 Is this an inactivity timeout? If so, you will need to notify the user from javascript when the timer is going to run out. Quote Link to comment https://forums.phpfreaks.com/topic/62981-users-online-question/#findComment-313655 Share on other sites More sharing options...
CBaZ Posted August 2, 2007 Author Share Posted August 2, 2007 i think it is just a session timer.. like you sign in it starts counting down the time. i wish i could turn this into an inactivity one.. with a window pop up do you still wanna be signed in.. blah blah etc. Quote Link to comment https://forums.phpfreaks.com/topic/62981-users-online-question/#findComment-313716 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.