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
  #12  
Old 02-15-2005, 03:57 AM
JC's Avatar
JC JC is offline
 
Join Date: Sep 2002
Location: California, USA
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will someone please take a look at my site, for some reason it's only half working, viewed here www.707imports.com/vb3 - I don't get it. I've tried this like 10x's! I'd be willing to let someone login and fix it haha.

user : tester
pw : pwforpaul
Reply With Quote
  #13  
Old 02-15-2005, 04:06 AM
JC's Avatar
JC JC is offline
 
Join Date: Sep 2002
Location: California, USA
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I actually installed a different version of this hack and it worked, yay! Thanks anyways!
Reply With Quote
  #14  
Old 02-15-2005, 11:49 AM
Rids's Avatar
Rids Rids is offline
 
Join Date: Aug 2002
Location: Wales
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice mod - thanks for sharing
Reply With Quote
  #15  
Old 02-15-2005, 06:11 PM
yinyang's Avatar
yinyang yinyang is offline
 
Join Date: May 2004
Location: Los Angeles
Posts: 580
Благодарил(а): 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 not the same. yours shows who registered that day and the total number of members.

this hack shows who Visited in the last 24 hours. For example, yours doesn't pick up guests.
Reply With Quote
  #16  
Old 02-15-2005, 07:53 PM
Elfo King Elfo King is offline
 
Join Date: Apr 2003
Location: Pisa-Italy
Posts: 54
Благодарил(а): 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?
same problem.....only guest e member for only 1 hour!
not for 24......solution ??
Reply With Quote
  #17  
Old 02-15-2005, 11:00 PM
Olsufr Olsufr is offline
 
Join Date: Feb 2003
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Elfo King, there is the answer:
Your statistics must be collected.

Quote:
Originally Posted by Olsufr
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).
Reply With Quote
  #18  
Old 02-16-2005, 04:59 PM
Elfo King Elfo King is offline
 
Join Date: Apr 2003
Location: Pisa-Italy
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ehm, sorry....
Another question:
Where i can change the statistics for collect more hours?
I need to change the value of the Hourly Cleanup #1 and/or Hourly Cleanup #2 ?

Thx
Reply With Quote
  #19  
Old 02-17-2005, 12:10 AM
Rids's Avatar
Rids Rids is offline
 
Join Date: Aug 2002
Location: Wales
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've had it installed for over 36 hours now and its still showing figures for 1h. In fact the figures seem to be all over the place:

Total users last 1h: 109 (94 members and 15 guests)

10 minutes later ...

Total users last 1h: 200 (181 members and 19 guests)

The actual number of active members that have been to the site all day is only 70 so where it is getting these figures from I have no idea. Could it be counting each and every visit by each member maybe?
Reply With Quote
  #20  
Old 02-17-2005, 02:07 AM
neocorteqz's Avatar
neocorteqz neocorteqz is offline
 
Join Date: May 2002
Location: Barefoot Bay Fl
Posts: 473
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Rids
I've had it installed for over 36 hours now and its stillshowing figures for 1h. In fact the figures seem to be all over theplace:

Total users last 1h: 109 (94 members and 15 guests)

10 minutes later ...

Total users last 1h: 200 (181 members and 19 guests)

The actual number of active members that have been to the site all dayis only 70 so where it is getting these figures from I have no idea.Could it be counting each and every visit by each member maybe?
Including Revisits from members, At least i think, as there reallyisn't a way of counting without checking against IP address.
Reply With Quote
  #21  
Old 02-17-2005, 01:05 PM
Olsufr Olsufr is offline
 
Join Date: Feb 2003
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Elfo King
Another question:
Where i can change the statistics for collect more hours?
I need to change the value of the Hourly Cleanup #1 and/or Hourly Cleanup #2 ?
Yes. To have statistics more than during 24 hours
you have to change this in my hack
(in includes/cron/cleanup.php
and includes/cron/cleanup2.php):
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 
to this:
PHP Code:
 $DB_site->query("
    ### Delete stale sessions ###
    DELETE FROM " 
TABLE_PREFIX "session
    WHERE lastactivity < " 
intval(TIMENOW 1*24*60*60)
); 
// modified by Oleg S.for 24h visitors' statistics 
where instead of 1 you can write another number (number of days of statistics)




and in index.php instead of this (lines of hack):

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

    
$datecut24 TIMENOW 86400
write:
PHP Code:
// ############# Oleg Subel - 24h visitors' statistics ###############

    
$datecut24 TIMENOW 1*24*60*60
where instead of 1 you can write another number (number of days of statistics)
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:58 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05025 seconds
  • Memory Usage 2,340KB
  • 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
  • (8)bbcode_php
  • (6)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
  • (3)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