Ticket #438 (closed Bug report: fixed)

Opened 14 years ago

Last modified 14 years ago

function getNumOnlineUsers() in classes/Node.php (incorrectly counts users using the same login)

Reported by: andrewhodel@… Owned by:
Priority: low Milestone: Not yet assigned to a Milestone
Component: Auth server, Statistics and reporting Version:
Keywords: Cc:


I don't understand the logic behind this, but the function performs a different query if the node isConfiguredSplashOnly(). The difference being counting users by mac, or counting users by login.

It seems logical to me to count users by mac by default? Another solution would be to count by mac if the allow multiple login flag is on for the network?

public function getNumOnlineUsers() {

$db = AbstractDb::getObject();

// Init values $retval = array (); $row = null;

#if (!$this->isConfiguredSplashOnly()) {

#$db->execSqlUniqueRes("SELECT COUNT(DISTINCT users.user_id) as count FROM users,connections WHERE connections.token_status='".TOKEN_INUSE."' AND users.user_id=connections.user_id AND connections.node_id='{$this->id}'", $row, false);

#} else {

$db->execSqlUniqueRes("SELECT COUNT(DISTINCT connections.user_mac) as count FROM connections WHERE connections.token_status='".TOKEN_INUSE."' AND connections.node_id='{$this->id}'", $row, false);


return $rowcount?;


My personal fix was just to comment out only to include the user_mac query.

Change History

Changed 14 years ago by benoitg

  • status changed from new to closed
  • resolution set to fixed

The function was kinda doing what it was meant to do: count distinct user accounts using the connection, if multiple logins are enabled. So indeed, if a network allows multiple logins, and somebody logs in using both his laptop and his PDA, there is only ONE user online (for purposes of profiles, chat, etc.)

Off course, if the node is splash only, it doesn't make sense to do this, as most likely there are multiple distinct users.

I presume if you have this problem, you are using multiple logins to allow the cafe staff to give out a single username and password as a workaround for password of the day not being implemented.

Since [1331] it now Counts every user account connected (once for every account), except the splash-only user + every mac addresses connecting as the splash-only user. The results should now be coherent regardless of the splash-only status, and now the network-wide count uses the same method.

Furthermore, the count will now be as you (presumably) intended, once code of the day is properly implemented. Now, since there is no "kinda fixed for the future" status, I'll just call it fixed if you don't mind ;)

Note: See TracTickets for help on using tickets.