Topic: I need a users online today mod

So someone posted one before, but now that page doesnt exsist anymore.

So can anyone link me to one?

Re: I need a users online today mod

I think it is "onlineToday", it is part of Puntal.

Re: I need a users online today mod

I can't find it on Punres anymore for some reason, but it's still available on PunBB.fr.

Looking for a certain modification for your forum? Please take a look here before posting.

4

Re: I need a users online today mod

i think there is somewere code...

// Collect some statistics from the database
$result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error());
$stats['total_users'] = $db->result($result);

$result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error());
$stats['last_user'] = $db->fetch_assoc($result);

$result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());
list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result);

?>
<div id="brdstats" class="block">
    <h2><span><?php echo $lang_index['Board info'] ?></span></h2>
    <div class="box">
        <div class="inbox">
            <dl class="conr">
                <dt><strong><?php echo $lang_index['Board stats'] ?></strong></dt>
                <dd><?php echo $lang_index['No of users'].': <strong>'. $stats['total_users'] ?></strong></dd>
                <dd><?php echo $lang_index['No of topics'].': <strong>'.$stats['total_topics'] ?></strong></dd>
                <dd><?php echo $lang_index['No of posts'].': <strong>'.$stats['total_posts'] ?></strong></dd>
            </dl>
            <dl class="conl">
                <dt><strong><?php echo $lang_index['User info'] ?></strong></dt>
                <dd><?php echo $lang_index['Newest user'] ?>: <a href="profile.php?id=<?php echo $stats['last_user']['id'] ?>"><?php echo pun_htmlspecialchars($stats['last_user']['username']) ?></a></dd>
<?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);
    // Most users-mod START
    // Set up the query and get the data
    $result = $db->query('SELECT * FROM '.$db->prefix.'most_users') or error('Unable to fetch most users online data', __FILE__, __LINE__, 

$db->error());

    $max_users_online = $db->fetch_assoc($result);
    // Add users and guests ´to $currently_online.
    // If you don't want to include guests, remove ' + $num_guests' below..
    $currently_online = $num_users + $num_guests;
    // If the amount of currently online users are more or equal to what was previously recorded..
    if ($currently_online>=$max_users_online['most_online']) 
    {
        // Set the time
        $max_users_online['when_was_it'] = time();
        // Set the amount of online users
        $max_users_online['most_online'] = $currently_online;
        // Store it in the table
        $db->query('UPDATE '.$db->prefix.'most_users SET most_online='.$currently_online.', when_was_it='.$max_users_online['when_was_it']) or error('Unable to update most users online data', __FILE__, __LINE__, $db->error());
    }
    // Most users-mod END
    // utilisateurs en ligne aujourd'hui
    $date = getdate(time());
    $todaystamp = mktime(0,0,0, $date['mon'], $date['mday'], $date['year']);

    $result = $db->query('SELECT username, id, last_visit from '.$db->prefix.'users WHERE last_visit >= \''.$todaystamp.'\' ORDER by last_visit DESC') or error('Impossible de retrouver la liste des utilisateurs en ligne aujourd\'hui', __FILE__, __LINE__, $db->error());

    $users_today = array();
    while ($pun_user_online_today = $db->fetch_assoc($result))
        $users_today[] .=  "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online_today['id'].'" title="Derni?re visite de '.$pun_user_online_today['username'].' : '.format_time($pun_user_online_today['last_visit']).'">'.$pun_user_online_today['username'].'</a>';
        
    $num_users_today = count($users_today);
    echo "\t\t\t\t".'<dd>'.$lang_index['Users online'].': <strong>'.$num_users.'</strong></dd>'."\n\t\t\t\t".'<dd>'.$lang_index['Users today'].': <strong>'.$num_users_today.'</strong></dd>'."\n\t\t\t\t".'<dd>'.$lang_index['Guests online'].': <strong>'.$num_guests.'</strong></dd>'."\n\t\t\t".'</dl>'."\n";

    if ($num_users > 0)
        echo "\t\t\t".'<dl id="onlinelist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].': </strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
    else
        echo "\t\t\t".'<div class="clearer"></div>'."\n";
    // liste utilisateurs en ligne aujourd'hui
    echo "\t\t\t".'<dl id="onlinetodaylist">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online today'].': </strong></dt>';
                
    if ($num_users_today > 0) 
        echo implode(' </dd> ', $users_today).'</dd>'."\n\t\t\t".'</dl>'."\n";
    else
        echo '<dd><em>jo? niko ;)</em></dd>'."\n\t\t\t".'</dl>'."\n";
}
else
    echo "\t\t".'</dl>'."\n\t\t\t".'<div class="clearer"></div>'."\n";


?>
        </div>
    </div>
</div>
it's just me...

Re: I need a users online today mod

Attention! Important Security upgrade for french mod "users online today" (Membres en ligne aujourd'hui).
See: http://www.punbb.fr/mods/mod.php?id=5

Credits to vin100 (PunBB.fr) and glycero