CBaZ Posted June 21, 2007 Share Posted June 21, 2007 I want to add how many admins are currently online and available just to be able to tell the number. Also I want to be able to tell all the usernames that are connected at one time if you are familiar with this I will try to provide my code as much as i possibly can to make it work for my login script please let me know asap... Quote Link to comment https://forums.phpfreaks.com/topic/56508-login-script-addon/ Share on other sites More sharing options...
redarrow Posted June 21, 2007 Share Posted June 21, 2007 A clue a timestamp and sessions ok. Quote Link to comment https://forums.phpfreaks.com/topic/56508-login-script-addon/#findComment-279096 Share on other sites More sharing options...
CBaZ Posted June 21, 2007 Author Share Posted June 21, 2007 I have a timestamp for regular users but no time stamp for admins let's see permission 0 is for regulars admin have permission 1 I am seeing the right totals for how many users are in that table just not the right amount currently logged in. <?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'"); $usersOnline = mysql_result($result, 0, 0); $connect = mysql_connect("localhost", "user", "pw") or die("Could not connect to database: " . mysql_error()); mysql_select_db("db", $connect) or die("Could not select database"); $result2 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '0'"); $row = mysql_fetch_array($result2); $result3 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '1'"); $row2 = mysql_fetch_array($result3); echo "ATM:" . ($usersOnline != 1 ? "" : "") . " $usersOnline Admin" . ($usersOnline != 1 ? "s" : "") ." / $row2[count]" . ", " . ($usersOnline != 1 ? "" : "") . " $usersOnline User" . ($usersOnline != 1 ? "s" : "") ." / $row[count]" . ". "; Quote Link to comment https://forums.phpfreaks.com/topic/56508-login-script-addon/#findComment-279098 Share on other sites More sharing options...
CBaZ Posted June 21, 2007 Author Share Posted June 21, 2007 I still need help with this ... so far the way I have it ... when I login as admin it adds 2 users to the admins online and also 2 users to the regulars anyone have a clue as to what I need to change? and I am not sure how to get my usernames to show. Quote Link to comment https://forums.phpfreaks.com/topic/56508-login-script-addon/#findComment-279505 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.