vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   24h Visitors' Statistics (members and guests) (https://vborg.vbsupport.ru/showthread.php?t=76242)

Olsufr 02-12-2005 10:00 PM

24h Visitors' Statistics (members and guests)
 
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

ericgtr 02-13-2005 03:23 PM

Just so you know, i've already released one myself here https://vborg.vbsupport.ru/showthrea...threadid=72972 :)

ALcorn 02-13-2005 03:29 PM

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 ;)

Olsufr 02-13-2005 03:30 PM

ericgtr, my hack counts, shows members and guests statistics.
It is different.

ericgtr 02-13-2005 03:31 PM

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! :)

James T Brock 02-13-2005 04:11 PM

Nice mod. I have the other one installed but I like the ability for this one to count guess users as well.

Harley77 02-14-2005 03:06 PM

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?

KanyeWest 02-14-2005 05:44 PM

i likey i really likey i installed

update justinstalled took nomore than 6 minutes

KanyeWest 02-14-2005 05:53 PM

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

Olsufr 02-14-2005 08:41 PM

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.


All times are GMT. The time now is 03:26 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.01091 seconds
  • Memory Usage 1,765KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (4)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete