vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Miscellaneous Hacks - HIT COUNTER! (Integrated With VB) (https://vborg.vbsupport.ru/showthread.php?t=112998)

Mr Chad 04-13-2006 10:00 PM

HIT COUNTER! (Integrated With VB)
 
If you like it click
https://vborg.vbsupport.ru/


Installation Time: <2 mins
Template Edits: 1
Plugins: 1
VB Version: This actually works on 3.5.0 - 3.5.4
Live Example (Look at my footer): http://beasttoast.com

Description:
This is a basic hit counter. It uses a little php script and a text file to store the hits (no DB because it would be too stressful). Also you dont have to display the hits on every page you could just put it on your forumhome template, and it will still count all the hits :cool:

Installation Instructions:
  1. Download and unzip 'plugin-pageviews.zip'
  2. Upload the folder 'Counter' into your forum directory
  3. Now open the 'Counter' folder, and CH MOD 666 the 'count.txt' file
  4. Install the plugin
  5. *Optional* If you want to be able to display the page views for today just create a Scheduled Task like this:

    Title: 'Page Views'
    Hour: '23'
    Min: '59'
    File Name: './counter/counter_daily.php'
  6. Place '$pageviews' and/or '$pageviewstoday' in any template where ever you want to display the hit count.
Screen Shot:
https://vborg.vbsupport.ru/ - Using Total Page Views
or
https://vborg.vbsupport.ru/ - Using Total Page Views and Todays Page Views

FAQ:
  1. Q: Where do I put the '$pageviews' thing?
  2. A: Well... If you dont know how to do this then ill just give you a standard spot to put it.
    1. Open up your footer template
    2. Then Find:
      Code:

      <div class="smallfont" align="center">$vbphrase[all_times_are_gmt_x_time_now_is_y]</div>
    3. And replace that with:
      Code:

      <div class="smallfont" align="center">$vbphrase[all_times_are_gmt_x_time_now_is_y]<br>total page views: $pageviews, page views today: $pageviewstoday</div>

If you like it click
https://vborg.vbsupport.ru/

This hack was based on ZIKI-SET's hack.

Ziki 04-14-2006 01:41 PM

This is cooler than the old version of mine.:)

Mr Chad 04-14-2006 01:47 PM

Quote:

Originally Posted by ZIKI-SET
This is cooler than the old version of mine.:)

I'm glad you like it. I scrapted some of your code :). Was gettin sick of the idea of loading an image. Because it reminded me of one of those bootleg free hit counter sites.

finn snor 04-14-2006 02:31 PM

Does this only work as a total views ?

Im looking for a way get a counter in my calendar that makes it possible for me to see how many that have seen the frontpage of calendar and total views of each event.

Can this handle that ?

Mr Chad 04-14-2006 02:41 PM

nope. You would want to use https://vborg.vbsupport.ru/showthread.php?t=109523.

or

If you replace the contents of the plugin XML file with:
PHP Code:

<?xml version="1.0" encoding="ISO-8859-1"?>

<plugins>
    <plugin active="1" product="vbulletin">
        <title>pageviews</title>
        <hookname>calendar_start</hookname>
        <phpcode><![CDATA[require_once('./counter/counter.php');]]></phpcode>
    </plugin>
</plugins>

Then that would only display the pageviews of the calander side. (this is not an extensive hack... Just something quick.)

Ntfu2 04-14-2006 07:21 PM

I followed instructions, placed it in my footer, and i've got nothing

Mr Chad 04-14-2006 07:56 PM

hmm. let me recheck the files

Mr Chad 04-14-2006 08:03 PM

Quote:

Originally Posted by Ntfu2
I followed instructions, placed it in my footer, and i've got nothing

Installed it on my second board... Works fine, only reason it doesnt work for you could be that you have one or both of these installed:

-Template Cache System
-Plugin Accelerator

and you have not refreshed the Cache for the templates or/and refreshed the plugin system.

Ntfu2 04-14-2006 10:53 PM

Quote:

Originally Posted by chatbum
Installed it on my second board... Works fine, only reason it doesnt work for you could be that you have one or both of these installed:

-Template Cache System
-Plugin Accelerator

and you have not refreshed the Cache for the templates or/and refreshed the plugin system.


Let me check

Nope, if you'd like i can PM you with some login details to check stuff out, i'm stumped


Edit, I fixed by CHMOD the count.txt file to 666 after upload

Mr Chad 04-14-2006 11:54 PM

Ok its good to see we got that resolved :)

NR Fatal 04-15-2006 01:13 AM

I tried uploading the plugin and then the page just reloaded. The plugin wont install. that's weird, know why?

Mr Chad 04-15-2006 02:05 AM

Quote:

Originally Posted by NR Fatal
I tried uploading the plugin and then the page just reloaded. The plugin wont install. that's weird, know why?

Then just create a plugin under:

Hook: global_start
Content: require_once('./counter/counter.php');

thats all :)

tonym 04-15-2006 04:17 AM

my counter counts by 2's not 1's :(

Mr Chad 04-15-2006 10:26 AM

Quote:

Originally Posted by tonym
my counter counts by 2's not 1's :(

You have a link?

There are a few reasons this could be happeneing:

- There is another person browsing your forum.
- One of your php files loads the global.php file twice...
- Or you changed the ++ to +2

daklay 04-15-2006 02:14 PM

hmmm.......

tonym 04-15-2006 02:18 PM

i didnt change anything.....where do i change +2 to +1?:banana:

Mr Chad 04-15-2006 02:47 PM

If you guys want i can give you my updated version, it adds the option to display todays page views and the total.

Mr Chad 04-15-2006 02:47 PM

Quote:

Originally Posted by tonym
i didnt change anything.....where do i change +2 to +1?:banana:

you dont need to do anything its working fine...

it uses $count++; which adds one.

tonym 04-15-2006 02:49 PM

Quote:

Originally Posted by chatbum
If you guys want i can give you my updated version, it adds the option to display todays page views and the total.

if you dont mind i would like that

Mr Chad 04-15-2006 03:01 PM

did it :)

you can now use:

$pageviews in any template to display the total like before
$pageviewstoday in any template to show todays page views

you will need to redownload it and replace the counter folder with the new one if you want to upgrade to the new one.

Snake 04-15-2006 05:27 PM

Works just fine. Thanks!

clearchannel 04-15-2006 05:49 PM

Would someone be so kind as to tell me where to place the following code:

Code:

Place '$pageviews' and/or '$pageviewstoday' in any template where ever you want to display the hit count.
I placed it at the very end of the footer, and it's only showing a number. In less then 5 minutes I've recorded a few hundered hits. I'd like it to look like the demo site.

Thanks in advance.

Mr Chad 04-15-2006 06:20 PM

Quote:

Originally Posted by clearchannel
Would someone be so kind as to tell me where to place the following code:

Code:

Place '$pageviews' and/or '$pageviewstoday' in any template where ever you want to display the hit count.
I placed it at the very end of the footer, and it's only showing a number. In less then 5 minutes I've recorded a few hundered hits. I'd like it to look like the demo site.

Thanks in advance.

  1. Open up your footer template
  2. Then Find:
    Code:

    <div class="smallfont" align="center">$vbphrase[all_times_are_gmt_x_time_now_is_y]</div>
  3. And replace that with:
    Code:

    <div class="smallfont" align="center">$vbphrase[all_times_are_gmt_x_time_now_is_y]<br>total page views: $pageviews, page views today: $pageviews</div>

Main reason i didnt put the in the instructions is because i like to see different uses :)

Mr Chad 04-15-2006 07:31 PM

ahh crap...

There was a problem with the counter_daily.php

So please redownload the zip and reupload the contents of the counter folder into your counter folder.

You only need to do this if you use $pageviewstoday . If you dont fix it $pageviewstoday and $pageviews will do the same thing.

tonym 04-15-2006 11:38 PM

would it be too hard to make it not count the same ip more than 1 time in a 24 hour period?:banana: :banana: :banana:

Mr Chad 04-15-2006 11:44 PM

Quote:

Originally Posted by tonym
would it be too hard to make it not count the same ip more than 1 time in a 24 hour period?:banana: :banana: :banana:

for me yes...

any way that would require useing the database and thats exactly what im trying not to do. I could try to use a cookie that expires every 24 hours. And it checks for that cookie if you dont have it, it would run the +1 to the hit and add the cookie.

clearchannel 04-15-2006 11:57 PM

I've reinstalled the script and all appears to be working as designed. I will know for sure tommorow.

I love it that I can use conditionals, it makes a great difference.

Thank you

Mr Chad 04-16-2006 12:05 AM

Quote:

Originally Posted by clearchannel
I've reinstalled the script and all appears to be working as designed. I will know for sure tommorow.

I love it that I can use conditionals, it makes a great difference.

Thank you

no problem, actually you can test it just by running the Scheduled Task after you have recieved a few hits. Oh and yea, I really wanted to make a text counter that was not an image, and didnt need a large script to run, or added a link to the counter site. So i made a very simple counter, with the help from ZIKI-SET's image counter.

Mr Chad 04-17-2006 12:00 PM

wow I had fun with this...

With a simple edit in the daily.php file I set it up so it sends me an email every day with the hits that day. And in my yahoo email account I added a filter that makes it forward the email to my cell phone as a text message. Now when im away I still know what my site hits are :)

Traxdata 04-17-2006 02:18 PM

Hi, nice hack but how do I remove it?

wizardan 04-17-2006 02:41 PM

Installed.
And seeing the stats properly displayed under the time.
However, I'm seeing the numerals again below the bottom copyright notice, at the very bottom.

Mr Chad 04-17-2006 09:11 PM

Quote:

Originally Posted by Traxdata
Hi, nice hack but how do I remove it?

Just reverse the installiation process...
  1. Delete the files you uploaded
  2. Uninstall the plugin
  3. Remove the variables you added to your template

Mr Chad 04-17-2006 09:12 PM

Quote:

Originally Posted by wizardan
Installed.
And seeing the stats properly displayed under the time.
However, I'm seeing the numerals again below the bottom copyright notice, at the very bottom.

Let me check :)

Are you sure you didnt add the variables more than once?

Lea Verou 04-17-2006 11:33 PM

Stupid question: Since when will the count start?
Nice hack btw :)

Mr Chad 04-18-2006 02:06 AM

right when you install the plugin :)

also you can edit the 'count.txt' to what you think your total hits are, but if you do this you need to put the same amount in the 'yesterday_count.txt'

clearchannel 04-18-2006 02:08 AM

Quote:

Originally Posted by chatbum
wow I had fun with this...

With a simple edit in the daily.php file I set it up so it sends me an email every day with the hits that day. And in my yahoo email account I added a filter that makes it forward the email to my cell phone as a text message. Now when im away I still know what my site hits are :)

What do I edit in the daily.php to accomplish this?

Mr Chad 04-18-2006 02:24 AM

hmm lets see, I hacked the hell out of my hack :P

Quote:

require_once('****FULL PATH****/counter/counter.php');

$to = "email@yahoo.com";
$from = "person";
$subject = "Hits";
$message = " $pageviewstoday page views today!";
mail( $to, $subject, $message,"From: $from\r\nX-Priority: 1 (Highest)" ) or print "could not send mail";
Put that right after the <? (starting php line) of your file, and you will need to go through the files and add all the full paths instead of ./counter/

if you don't know your path then just upload this in the same directory

make a php file named 'path.php' and put this in it:
PHP Code:

<?php
if ($_SERVER['PATH_TRANSLATED'])
{
    
$path $_SERVER['PATH_TRANSLATED'];
}
else if (
$_SERVER['SCRIPT_FILENAME'])
{
    
$path $_SERVER['SCRIPT_FILENAME'];
}
else
{
    echo 
'We are sorry, but this script is unable to determine your forums path.';
    exit;
}
echo 
substr($path0, (strlen($path) - 8));
?>

run that and it will tell you it.

Mr Chad 04-18-2006 03:51 AM

ill make a better guide... or a better way looks like this isnt working well, just got mine to actually work.

Traxdata 04-18-2006 01:20 PM

Quote:

Originally Posted by chatbum
Just reverse the installiation process...
  1. Delete the files you uploaded
  2. Uninstall the plugin
  3. Remove the variables you added to your template

Hi chatbum,

thanks for your reply, well that's how I remove all hacks from my forums... but where can I find this counter plugin? I searched and searched... and found nothing.

btw, it seems to be dangerous to delete counter files at first... have got error messages

Mr Chad 04-18-2006 08:59 PM

Quote:

Originally Posted by Traxdata
Hi chatbum,

thanks for your reply, well that's how I remove all hacks from my forums... but where can I find this counter plugin? I searched and searched... and found nothing.

btw, it seems to be dangerous to delete counter files at first... have got error messages

Well my bad...
  1. Uninstall the plugin
  2. Delete the files you uploaded
  3. Remove the variables you added to your template

first uninstall the plugin :)


All times are GMT. The time now is 04:53 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.01707 seconds
  • Memory Usage 1,838KB
  • 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_code_printable
  • (2)bbcode_php_printable
  • (16)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
  • (40)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