Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Users online in admin panel

 
Reply to topic    Forum Index » Additional Downloads View previous topic
View next topic
Users online in admin panel
Author Message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2801
Location: Germany

Post Users online in admin panel Reply with quote
The following hack shows which users were online in the last 5 minutes.

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


to this:
Code:
   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:
<?
   }
?>

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


to this:
Code:
<?
   }

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>

Tue Feb 19, 2008 8:04 pm View user's profile Send private message
Guest








Please login to hide the ads.

alven



Joined: 05 Jul 2006
Posts: 126

Post Reply with quote
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.
Thu Mar 06, 2008 2:39 pm View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2801
Location: Germany

Post Reply with quote
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.
Thu Mar 06, 2008 7:37 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    Forum Index » Additional Downloads All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.