 |
 |
 |
 |
 |
| Author |
Message |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
Users online in admin panel |
|
The following hack shows which users were online in the last 5 minutes.
1. Open head.php and change this:
 |  | if ($action == 'dologin'){
$sql->update(array(
'table' => 'users',
'where' => array("username = $username"),
'values' => array('last_visit' => (time() + $config_date_adjust * 60))
));
} |
to this:
 |  | 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:
 |  | <?
}
?>
</table>
<td>
<td> |
to this:
 |  | <?
}
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>
<td> |
|
|
| Tue Feb 19, 2008 8:04 pm |
|
 |
Guest
|
|
|
Please login to hide the ads.
|
|
|
|
 |
alven
Joined: 05 Jul 2006 Posts: 126
|
|
|
|
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 |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
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 |
|
 |
|
|
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
|
|
 |
 |
 |
|