Jump to content

Recommended Posts

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...

 

 

Link to comment
https://forums.phpfreaks.com/topic/56508-login-script-addon/
Share on other sites

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]" . ". ";

Link to comment
https://forums.phpfreaks.com/topic/56508-login-script-addon/#findComment-279098
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.