Topic: Online users = Guest + Members i want total to be precented

How do i precent online users that include guests + members

2

Re: Online users = Guest + Members i want total to be precented

http://punbb.org/forums/viewtopic.php?id=11132

I asked the same, and got help in that thread.

Re: Online users = Guest + Members i want total to be precented

divide the number of active users (users, & guests) with the total number of registered users.

e.g. round((100 * $total_active) / $total_registered)

Re: Online users = Guest + Members i want total to be precented

averagehippy wrote:

divide the number of active users (users, & guests) with the total number of registered users.

e.g. round((100 * $total_active) / $total_registered)

No. Will do no good.

Re: Online users = Guest + Members i want total to be precented

Endre wrote:

http://punbb.org/forums/viewtopic.php?id=11132

I asked the same, and got help in that thread.

Thanx that will help alot :-)

http://punbb.org/forums/viewtopic.php?pid=65975#p65975

6 (edited by lhffan 2006-07-15 15:32)

Re: Online users = Guest + Members i want total to be precented

It helped a bit so i created this one and included this in my header and it works but not as it should, i guess it have to do with how i used it.

When 1 person is logged in and a guest is wieving the forum it says 2 users, but if two guests are wiewing the forum it says 1 user is looking at the forum

Eyy That can be because i viewing it from the same ip i think?

<?php
if ($pun_config['o_users_online'] == '1')
{
    // Fetch users online info and generate strings for output
    $num_guests = 0;
    $users = array();
    $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());

    while ($pun_user_online = $db->fetch_assoc($result))
    {
        if ($pun_user_online['user_id'] > 1)
            $users[] = "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>';
        else
            ++$num_guests;
    }
    $num_users = count($users);
  echo ($num_users + $num_guests);
  }
?>

7

Re: Online users = Guest + Members i want total to be precented

did anyone try AJAX on this? ie, online list being updated.. say every 15 seconds without refreshing the page.?