Users online in admin panel

Download plugins, language packs and stuff.

Users online in admin panel

Postby FI-DD » Tue Feb 19, 2008 8:04 pm

The following hack shows which users were online in the last 5 minutes.

1. Open head.php and change this:
Code: Select all
   if ($action == 'dologin'){
      $sql->update(array(
      'table'    => 'users',
      'where'    => array("username = $username"),
      'values' => array('last_visit' => (time() + $config_date_adjust * 60))
      ));
   }


to this:
Code: Select all
   if ($action == 'logout'){
      $sql->update(array(
      'table'    => 'users',
      'where'    => array("username = $username"),
      'values' => array('last_visit' => (time() + $config_date_adjust * 60 - 301))
      ));
   }
   
   else{
      $sql->update(array(
      'table'    => 'users',
      'where'    => array("username = $username"),
      'values' => array('last_visit' => (time() + $config_date_adjust * 60))
      ));
   }


2. Open inc/mod/main.mdu and change this:
Code: Select all
<?
   }
?>

</table>
<td>&nbsp;
<td>


to this:
Code: Select all
<?
   }

if($member['level'] == 1){

   $check_time = time() + $config_date_adjust * 60 - 300;
   $online_users = '';

   foreach($sql->select(array('table' => 'users', 'where' => array("level > 1", 'and', "last_visit > ".$check_time))) as $row){
      $online_users .= ($row['name'] ? $row['name'] : $row['username']).', ';
   }
   
   $online_users = substr($online_users, 0, -2);
?>


<tr><td>Users online</td><td width="50%"><?=$online_users; ?></td></tr>

<?
}
?>

</table>
<td>&nbsp;
<td>
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby alven » Thu Mar 06, 2008 2:39 pm

Thanks FI-DD for this new feature but when I tried to log in it display the login page again to enter user name and password and I can’t login at all.
Thanks in advance.
alven
 
Posts: 126
Joined: Wed Jul 05, 2006 5:21 pm

Postby FI-DD » Thu Mar 06, 2008 7:37 pm

Then you made a mistake when you installed it. I just tested it again with a fresh version of CNR and it's working great.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby marcusmagalhaes » Wed Dec 16, 2009 7:02 pm

I can see all visits of users? day, hour ..... access log ....
marcusmagalhaes
 
Posts: 163
Joined: Tue Apr 24, 2007 1:17 pm


Return to Additional Downloads



Who is online

Users browsing this forum: No registered users and 1 guest