Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

Reply
 
Thread Tools
24h Visitors' Statistics (members and guests) Details »»
24h Visitors' Statistics (members and guests)
Version: 1.00, by Olsufr Olsufr is offline
Developer Last Online: Mar 2005 Show Printable Version Email this Page

Version: 3.0.6 Rating:
Released: 02-12-2005 Last Update: Never Installs: 28
 
No support by the author.

A very simple display of statistics of all visitors (members and guests) who have visited the forum last 24 hours.

It displays the statistics on Forum Home in the section of "Users online":

example: " Total users last 24h: 2692 (members : 741, guests : 1951) "

There is no additional SQL query.

----------------------------------

Installation (there is in attached file)

Step 1

In index.php

Find:

PHP Code:
    $show['loggedinusers'] = true;
}
else
{
    
$show['loggedinusers'] = false;

And insert this code before it:

PHP Code:
    // ############# Oleg Subel - 24h visitors' statistics ###############

    
$datecut24 TIMENOW 86400;
    
$numberregistered24 0;
    
$numberguest24 0;

    
$forumusers24 $DB_site->query("
        SELECT userid, lastactivity FROM " 
TABLE_PREFIX "session
        WHERE lastactivity > 
$datecut24
    "
);

    
$time24 TIMENOW ;
    while (
$loggedin24 $DB_site->fetch_array($forumusers24))
    {
        
$userid24 $loggedin24['userid'];
        if (!
$userid24)
        {    
// Guest
            
$numberguest24++;
        }
        else
        {
            
$numberregistered24++;
        }
        if (
$loggedin24['lastactivity'] < $time24)
        {
            
$time24 $loggedin24['lastactivity'];
        }
    }
    
$time24 TIMENOW $time24;
    
$time24 floor($time24 3600) + (($time24 3600) ? 0);

    
$numbertotal24 $numberregistered24 $numberguest24;

    
// memory saving
    
unset($loggedin24);
    
$DB_site->free_result($forumusers24);
    
// ############# End of 24h visitors' statistics ############### 
Step 2

In includes/cron/cleanup.php
and in includes/cron/cleanup2.php

Find:

PHP Code:
$DB_site->query("
    ### Delete stale sessions ###
    DELETE FROM " 
TABLE_PREFIX "session
    WHERE lastactivity < " 
intval(TIMENOW $vboptions['cookietimeout'])
); 
And replace with this code:

PHP Code:
$DB_site->query("
    ### Delete stale sessions ###
    DELETE FROM " 
TABLE_PREFIX "session
    WHERE lastactivity < " 
intval(TIMENOW 86400)
); 
// modified by Oleg S.for 24h visitors' statistics 
Step 3

Add new phrase

Phrase Type: GLOBAL
Varname: active_users_24h
Text:
Code:
Total users last {1}h
Step 4

FORUMHOME template modification

Find:

Code:
			<a href="online.php?$session[sessionurl]">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>)
		</td>
and replace with:

Code:
			<a href="online.php?$session[sessionurl]">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>)
			&nbsp;&nbsp;&nbsp;&nbsp;<phrase 1="$time24">$vbphrase[active_users_24h]</phrase>: $numbertotal24 (<phrase 1="$numberregistered24" 2="$numberguest24">$vbphrase[x_members_and_y_guests]</phrase>)
		</td>
END

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 02-18-2005, 02:48 AM
kall's Avatar
kall kall is offline
 
Join Date: Apr 2004
Location: New Zealand
Posts: 2,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yup, same here.

http://forums.nzboards.com

I think I saw 2 hours once, but that was it.

*edit* Ahh, I was a moron.

You have to edit both of the /includes/cron/ files (as per the instructions), or it doesn't work.
Reply With Quote
  #23  
Old 02-22-2005, 08:14 PM
TTG's Avatar
TTG TTG is offline
 
Join Date: May 2004
Location: Sth London
Posts: 1,042
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Tried this hack .. idea is good but every time a member comes back to the main page the stats jump up in number = to the number of members / guests viewing main page.

Every main page refresh adds the number of existing viewers to the exisiting total.
Reply With Quote
  #24  
Old 02-23-2005, 12:55 PM
Omega Prime's Avatar
Omega Prime Omega Prime is offline
 
Join Date: Sep 2002
Location: ::Infinity::
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Guess this didn't work out...

I added this hack, but like most peple here, I noticed how the member stats kept rising whenever anyone (whether it was someone who visited just now or 10min ago) would add to the stats. After removing it from forumhome (since I was gonna see about working with it later) and adjusting the clock on the server, it shows over 2000 members online! It caused the CPU to max out to 100%, to the point where I had to close the forum and delete the sessions. It seems things are up and running again, but now it shows "Most users ever online was 2142, Today at 09:21 AM.", as well as showing members who are online when they shouldn't be online (within showthread) =/
Reply With Quote
  #25  
Old 02-23-2005, 10:59 PM
Olsufr Olsufr is offline
 
Join Date: Feb 2003
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

TTG, it is using standard (for vB3) online system. I didn't change anyone here.
Reply With Quote
  #26  
Old 03-16-2005, 01:25 AM
whelck whelck is offline
 
Join Date: Jun 2004
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Whatever this is doing isn't right. It says in the past 7 hours I've had 4974 members and 576 guests. I don't even have that many registered members.

*uninstalls*
Reply With Quote
  #27  
Old 03-18-2005, 06:55 PM
xtreme-mobile xtreme-mobile is offline
 
Join Date: Jul 2004
Posts: 366
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

am i doing something wrong?

mine just shows like this.... (see screen shot

it just shows amount of threads and thats about it
Reply With Quote
  #28  
Old 03-19-2005, 01:13 AM
Neutral Singh's Avatar
Neutral Singh Neutral Singh is offline
 
Join Date: Sep 2004
Location: Sikh Philosophy Network
Posts: 545
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank You, I was looking for this modification for a long long time !!
Reply With Quote
  #29  
Old 03-19-2005, 05:10 AM
KanyeWest's Avatar
KanyeWest KanyeWest is offline
 
Join Date: Dec 2004
Location: Mohegan Lake Ny
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this hack i still use today from first realease its awseom

Total users last 24h: 542 (345 members and 197 guests)

www.idenonfire.com/forums/ still usin proudly
Reply With Quote
  #30  
Old 04-14-2005, 01:17 PM
Neutral Singh's Avatar
Neutral Singh Neutral Singh is offline
 
Join Date: Sep 2004
Location: Sikh Philosophy Network
Posts: 545
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Activity during last 24 hour(s): 891 (74 members and 817 guests and [ARG:3 UNDEFINED] spiders)
Ever since i installed that hack to show web spiders on who is online... the above error is bold is showing up. I think in the following code another query about the spiders has to added... Olsufr, it would be wonderful if you could provide the code for adding the count for spiders too... best regards.


Quote:
// ############# Oleg Subel - 24h visitors' statistics ###############

$datecut24 = TIMENOW - 86400;
$numberregistered24 = 0;
$numberguest24 = 0;

$forumusers24 = $DB_site->query("
SELECT userid, lastactivity FROM " . TABLE_PREFIX . "session
WHERE lastactivity > $datecut24
");

$time24 = TIMENOW ;
while ($loggedin24 = $DB_site->fetch_array($forumusers24))
{
$userid24 = $loggedin24['userid'];
if (!$userid24)
{ // Guest
$numberguest24++;
}
else
{
$numberregistered24++;
}
if ($loggedin24['lastactivity'] < $time24)
{
$time24 = $loggedin24['lastactivity'];
}
}
$time24 = TIMENOW - $time24;
$time24 = floor($time24 / 3600) + (($time24 % 3600) ? 1 : 0);

$numbertotal24 = $numberregistered24 + $numberguest24;

// memory saving
unset($loggedin24);
$DB_site->free_result($forumusers24);
// ############# End of 24h visitors' statistics ###############
Reply With Quote
  #31  
Old 04-14-2005, 01:29 PM
eva01_'s Avatar
eva01_ eva01_ is offline
 
Join Date: Aug 2004
Location: Plymouth
Posts: 255
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

to get rid of that bold error you have to check your file changes again and make sure you did the template changes as well
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:11 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05518 seconds
  • Memory Usage 2,329KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete