vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   [release vB2.0]couter in vB page (https://vborg.vbsupport.ru/showthread.php?t=18096)

05-24-2001 10:00 PM

a. open vb2/global.php

find:

PHP Code:

// ###################### Start init ####################### 

Immediately ABOVE it put any PHP counter, i using this:

PHP Code:

// ipcounter hack by CX
// config
// create these two files count.txt and ip.txt, chmod them to 777
$count_file "count.txt";
$ip_file "ip.txt";
$userip getenv('REMOTE_ADDR');  // in some fixed IP server, change this line to $userip = getenv('HTTP_X_FORWARDED_FOR');

$count_temp=file($count_file);
$ip_temp=file($ip_file);

$detail=explode("|",$count_temp[0]);
$count_t=getdate(time());
$count_day=$count_t['mday'];

if (
$detail[0]==$count_day) {
    
$detail[1]++;
    
$detail[2]++;

    
$count=count($ip_temp);
    
$check=1;
    for (
$i=0$i<$count$i++) {
        
$ip_list=str_replace("\r","",str_replace("\n","",$ip_temp[$i]));
        if (
$ip_list==$userip$check=0;
    }
    if (
$check==1) {
        
$detail[3]++;
        
$detail[4]++;
        
$fp=fopen($ip_file,"a");
        
flock($fp,3);
        
fputs($fp,$userip."\n");
        
fclose($fp);
    }
}
else {
    
$detail[0]=$count_day;
    
$detail[1]=1;
    
$detail[3]=1;
    
$detail[2]++;
    
$detail[4]++;
    
$fp=fopen($ip_file,"w");
    
flock($fp,3);
    
fputs($fp,$userip."\n");
    
fclose($fp);
}

$new=implode("|",$detail);
$fp=fopen($count_file,"w");
flock($fp,3);
fputs($fp,$new);
fclose($fp);

// end ipcounter hack 

b. edit the template footer

find in last:

PHP Code:

</smallfont>
</
p

Immediately ABOVE it put:

PHP Code:

<br><br>
page views:&nbsp;&nbsp;today $detail[1],&nbsp;&nbsp;total $detail[2].&nbsp;&nbsp;variant IP visitors:&nbsp;&nbsp;today $detail[3],&nbsp;&nbsp;total $detail[4]. 

Done!

First-Man 05-25-2001 04:36 PM

Where can i see an Demo?
thx

bbqfan 05-25-2001 06:41 PM

see the demo.jpg:

Degen 05-25-2001 06:55 PM

It works on my board, but I get this at the top of my page :

Warning: file("../addons/count.txt") - No such file or directory in /home/gaminghq/public_html/forums/global.php on line 69

Warning: file("../addons/ip.txt") - No such file or directory in /home/gaminghq/public_html/forums/global.php on line 70

Warning: fopen("../addons/ip.txt","w") - No such file or directory in /home/gaminghq/public_html/forums/global.php on line 101

Warning: Supplied argument is not a valid File-Handle resource in /home/gaminghq/public_html/forums/global.php on line 102

Warning: Supplied argument is not a valid File-Handle resource in /home/gaminghq/public_html/forums/global.php on line 103

Warning: Supplied argument is not a valid File-Handle resource in /home/gaminghq/public_html/forums/global.php on line 104

Warning: fopen("../addons/count.txt","w") - No such file or directory in /home/gaminghq/public_html/forums/global.php on line 108

Warning: Supplied argument is not a valid File-Handle resource in /home/gaminghq/public_html/forums/global.php on line 109

Warning: Supplied argument is not a valid File-Handle resource in /home/gaminghq/public_html/forums/global.php on line 110

Warning: Supplied argument is not a valid File-Handle resource in /home/gaminghq/public_html/forums/global.php on line 111

Not sure what to make of this :(

bbqfan 05-25-2001 07:41 PM

see this?
PHP Code:

$cxip_count_file "../addons/count.txt";  // check the path
$cxip_file "../addons/ip.txt";           // check the path 

check the path first plx...:(
i set the path of count.txt and ip.txt to "../addons/", if you like, you can change it to anything else...

or like this:

chage those two lines to:

PHP Code:

$cxip_count_file "count.txt";  // check the path
$cxip_file "ip.txt";           // check the path 

it will be ok!

bokhalifa 05-25-2001 07:42 PM

good werk;)

Blue2000 05-26-2001 12:16 PM

i made a live counter ages ago

its posted here somwhere

i can repost it if people what it

maverick1236 05-26-2001 12:56 PM

Id like to see it :)

TimberLand 05-26-2001 04:11 PM

Anyway to make this an option only the admin can see.

ztsky 05-26-2001 05:22 PM

Good hack.
I'll try it on my vb page.
ccxx


All times are GMT. The time now is 12:32 AM.

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.01016 seconds
  • Memory Usage 1,759KB
  • 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
  • (6)bbcode_php_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