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
  #2  
Old 02-13-2005, 03:23 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just so you know, i've already released one myself here https://vborg.vbsupport.ru/showthrea...threadid=72972
Reply With Quote
  #3  
Old 02-13-2005, 03:29 PM
ALcorn ALcorn is offline
 
Join Date: Oct 2004
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ericgtr
Just so you know, i've already released one myself here https://vborg.vbsupport.ru/showthrea...threadid=72972
Your hack is about the number of newly registered users, not about the stats of registered users AND guests visited the forum in last 24 hours
Reply With Quote
  #4  
Old 02-13-2005, 03:30 PM
Olsufr Olsufr is offline
 
Join Date: Feb 2003
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ericgtr, my hack counts, shows members and guests statistics.
It is different.
Reply With Quote
  #5  
Old 02-13-2005, 03:31 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ALcorn
Your hack is about the number of newly registered users, not about the stats of registered users AND guests visited the forum in last 24 hours
Right you are. I was checking this over and it's pretty slick, nice mod!
Reply With Quote
  #6  
Old 02-13-2005, 04:11 PM
James T Brock James T Brock is offline
 
Join Date: Sep 2004
Posts: 273
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice mod. I have the other one installed but I like the ability for this one to count guess users as well.
Reply With Quote
  #7  
Old 02-14-2005, 03:06 PM
Harley77 Harley77 is offline
 
Join Date: Jul 2002
Location: Minnesota
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Having an issue, It only seems to show users from the last 1h. It reads on my forum home
Total users last 1h: 49 (34 members and 15 guests)

This number has been fluxuating up and down as time passes. Where do I need to look to fix this?
Reply With Quote
  #8  
Old 02-14-2005, 05:44 PM
KanyeWest's Avatar
KanyeWest KanyeWest is offline
 
Join Date: Dec 2004
Location: Mohegan Lake Ny
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i likey i really likey i installed

update justinstalled took nomore than 6 minutes
Reply With Quote
  #9  
Old 02-14-2005, 05:53 PM
KanyeWest's Avatar
KanyeWest KanyeWest is offline
 
Join Date: Dec 2004
Location: Mohegan Lake Ny
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Harley77
Having an issue, It only seems to show users from the last 1h. It reads on my forum home
Total users last 1h: 49 (34 members and 15 guests)

This number has been fluxuating up and down as time passes. Where do I need to look to fix this?
i think i found problem

Step 3. ################################################## ################

Add new phrase

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

it should be 24 but waht do i no im not a coder
Reply With Quote
  #10  
Old 02-14-2005, 08:41 PM
Olsufr Olsufr is offline
 
Join Date: Feb 2003
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

KanyeWest, the code is right.
My hack shows visitor's statistics and indicates real time for it.
For example, if there are sessions in your SESSIONS table in DB only for 1 hour,
this hack shows as you say:
Quote:
Total users last 1h: 49 (34 members and 15 guests)
It is start only.

Later your statistics will be collected more and more hour by hour.
And after 24 hours hack will show statistics for 24 hours (no more).

Quote:
Originally Posted by KanyeWest
i think i found problem

Step 3. ################################################## ################

Add new phrase

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

it should be 24 but waht do i no im not a coder
There is no error.
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 03:20 AM.


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.06124 seconds
  • Memory Usage 2,316KB
  • Queries Executed 23 (?)
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
  • (5)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
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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