REGISTER or LOGIN to have the annoying ads removed.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
deepstats
#1
In my forum what still running on 1.2 I am using more stats as the regulary one. Those stats mod was made by Zahler and was a part of a mod (sideboxes) that I do not use anymore. For some stats he wrote a small code.
This code did work only when I used the side boxes, so I did not deactivate that code in mybb 1.2 only some modification so that the sideboxes did not show up.

After testing a creating my testforum I am almost ready to do the big upgrade to 1.4 but I am still missing my lovely stats.
My question is can somebody redesign the code bellow so it works for 1.4

PHP Code:
//Start deep stats
//zaher1988
$timesearch time() - $mybb->settings['wolcutoffmins']*60;
$query $db->query("SELECT uid FROM ".TABLE_PREFIX."sessions WHERE time>'$timesearch' ORDER BY time DESC");
$users_count 0;
$guest_count 0;
while(
$on_line $db->fetch_array($query))
{
    if(
$on_line['uid'] == 0)
    {
        
$guest_count++;
    }
    else
    {
        
$users_count++;
    }    
}
    
$total_online $users_count $guest_count;
    
$oneday_timesearch time() - (60*60*24);
    
$query $db->query("SELECT sid FROM ".TABLE_PREFIX."sessions WHERE time>'$oneday_timesearch'");
    
$today_online $db->num_rows($query);
    
//Forum stats
    
$stats $cache->read("stats");


    if(!
$stats['lastusername'])
    {
        
$newestmember "no-one";
    }
    else
    {
        
$newestmember build_profile_link($stats['lastusername'], $stats['lastuid']);
    }
    
$total_posts my_number_format($stats['numposts']);
    
$total_threads my_number_format($stats['numthreads']);
    
$total_users =  my_number_format($stats['numusers']);
    
    
//Posts today
    
$total_posts_today $db->num_rows($db->query("SELECT * FROM ".TABLE_PREFIX."posts WHERE dateline>'$oneday_timesearch'"));
    
$onehour_timesearch time() - (60*60);
    
$total_posts_lasthour $db->num_rows($db->query("SELECT * FROM ".TABLE_PREFIX."posts WHERE dateline>'$onehour_timesearch'")); 


See the code at work on http://www.ikf-forum.eu/index.php and scroll down till forumstats (at the end).

For 1.2 it was easy to add those stats I only had to put for example $total_posts_today and the stats of the post that where made today where in my stats.

I hope somebody can design the stats for

visitors today:
postings today:
postings last hour:
total users omnline:
Because those ones I am missing on my (till now) test forum http://www.ikf-forum.eu/testforum

Kind regards,

Robert de Kort
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)