TinyPortal

Development => Block Codes => Topic started by: evillair on March 01, 2006, 04:38:07 PM

Title: Counter block
Post by: evillair on March 01, 2006, 04:38:07 PM
I downloaded the php counter from: http://www.phpjunkyard.com/php-text-hit-counter.php

Follow the very simple instuctions to install.

My html block code is:
<SCRIPT LANGUAGE="Javascript" SRC="http://www.pixelmorgue.com/counter/counter.php?page=index"><!--
//--></SCRIPT>


Once I registered 1 hit I went to the /logs folder on my ftp and changed the number to the current hits of the website (I added the ones from the stats page).

It only counts the "index.php" (if you add page=index.php that is) not any of the other hits for example "index.php?action=forum" won't be counted.

I also enabled the referal stuff.
in counter.php I edited the following lines:
// Enable referer validation? 1 = YES, 0 = NO
$check_referer = 1;
// Domains that are allowed to access this script
$referers = array ("localhost","pixelmorgue.com");


Thanks
Title: Re: Counter block
Post by: gerrymo on March 02, 2006, 11:17:57 AM
Excellent find. Using it now for total page views.
Title: Re: Counter block
Post by: gerrymo on March 02, 2006, 01:20:55 PM
I've also added their link manager. Works perfectly. Only one problem is that you have to add the style.css in manually to the public part. By default its is only for the Admin area. Simply add

<link rel="STYLESHEET" type="text/css" href="style.css">

To the Header under the Title Tags, and alter it to suit you theme.
Title: Re: Counter block
Post by: alan s on March 06, 2006, 12:53:17 PM
dosent work for me? i uploaded the counter to the smf directory   http://cknetworx.com/~/whiplash/smf/counter.php

and put in this script

<SCRIPT LANGUAGE="Javascript" SRC="http://www./cknetworx.com/~/whiplash/smf/counter.php?page=index"><!--
//--></SCRIPT>

and set the box to   javascript/html

any ideas on what i did wrong?
Title: Re: Counter block
Post by: gerrymo on March 06, 2006, 01:24:29 PM
It needs to be in its own directory with permissions set to 777 as it writes its log files to there. Install it in a directory called counter, and use the code from the first post, it will work then.

Put the directory in your site root: yourdomain.com/counter
Title: Re: Counter block
Post by: alan s on March 06, 2006, 01:29:34 PM
nope still dosent work , created its own directory and set the permissions to 755 ( it would only go to that )
Title: Re: Counter block
Post by: alan s on March 06, 2006, 01:36:12 PM
this is the url of it       http://cknetworx.com/~/whiplash/counter/counter.php
Title: Re: Counter block
Post by: gerrymo on March 06, 2006, 01:58:26 PM
You'll need to get it to 777. If it wont go to 777 via FTP, you could try through cPanel, or your online file manager (if you have one).
Title: Re: Counter block
Post by: crip on March 06, 2006, 02:24:08 PM
lol
Title: Re: Counter block
Post by: alan s on March 06, 2006, 02:31:43 PM
for some reason i cant get it past 755.............
Title: Re: Counter block
Post by: gerrymo on March 06, 2006, 02:36:12 PM
You could ask you host about it. Some hosts are funny about 777. Even if the just set this one and your SMF directory to 777, and leave the rest. You do have SMF/TP dont you?
Title: Re: Counter block
Post by: alan s on March 06, 2006, 02:39:45 PM
yea i do.............i'll ask my host about that
Title: Re: Counter block
Post by: crip on March 06, 2006, 02:44:54 PM
Command it 777
Title: Re: Counter block
Post by: alan s on March 06, 2006, 04:51:11 PM
got it to 777 and it still dosent work
Title: Re: Counter block
Post by: gerrymo on March 06, 2006, 05:12:06 PM
You're doing something wrong then. What script are you using to call it to the block, and what is the URL of the counter?
Title: Re: Counter block
Post by: evillair on March 06, 2006, 05:21:26 PM
you have a /logs folder also?

Read over the install text to make sure you didn't miss any steps
Title: Re: Counter block
Post by: alan s on March 07, 2006, 01:41:21 PM
this is the url of the counter http://whiplash.xtremefh.com/counter/counter.php       this is the script of the block     
<SCRIPT LANGUAGE="Javascript" SRC="http://www.whiplash.xtremefh.com/counter/counter.php?page=index"><!--
//--></SCRIPT>


and i have it set to a javascript/html block
Title: Re: Counter block
Post by: gerrymo on March 07, 2006, 02:09:37 PM
Try removing ?page=index See if that works, then we'll see if we can do something from there.
Title: Re: Counter block
Post by: alan s on March 07, 2006, 02:15:57 PM
nope dosent work..........................
Title: Re: Counter block
Post by: gerrymo on March 07, 2006, 05:20:29 PM
I've compared you script with mine, and they match, so its not the script that is wrong. Next check to make is that all your permissions are right. These all need to be set at 777

/counter/
/counter/counter.php
/counter/logs/
/counter/logs/.log.txt

Make sure they are all at 777. The .log file is where the count is stored. Download it and see what it says. Make sure when you put it back it still is called .log.txt and not log.txt
Title: Re: Counter block
Post by: alan s on March 08, 2006, 12:00:19 PM
i'd say i've found the problem.......i didnt have a logs folder
Title: Re: Counter block
Post by: alan s on March 08, 2006, 12:50:39 PM
just one more Q : how do i edit it now to show the total amount of hits that i get from my cpanel stats?
Title: Re: Counter block
Post by: gerrymo on March 08, 2006, 02:48:48 PM
Take the total hits, and edit the .log file to show that amount.
Title: Re: Counter block
Post by: crip on March 10, 2006, 01:30:05 PM
Do you have to upload a .log.txt page into the logs folder or does it create one it`s self?
Title: Re: Counter block
Post by: gerrymo on March 10, 2006, 01:37:14 PM
It creates it. If you want to, you can download it via FTP, edit it, and re-upload it.
Title: Re: Counter block
Post by: alan s on March 10, 2006, 01:39:31 PM
will do as soon as i get a new forum up
Title: Re: Counter block
Post by: alan s on March 10, 2006, 02:03:24 PM
i sorted out the counter......it works now but i just wanted to know how to edit the figure its displaying thanks
Title: Re: Counter block
Post by: crip on March 10, 2006, 02:15:07 PM
I got it,
on my server directories need to be set 755, files set 644, works like this... thanks, pretty cool script.
Title: Re: Counter block
Post by: yjobcreations on March 27, 2007, 11:42:18 AM
is there a way to extract the data from the Forum General Statistics page which indicates Total Page views?

I mean, without the use of third party sites, just the plain data from the SMF stats and then display that in a block?

just like what the coders here did to the birthdays in SSI and events and so on, maybe they could get the Total Page views data also and put it in a block which increments together with the General Stats.
Title: Re: Counter block
Post by: G6Cad on March 27, 2007, 12:02:11 PM
Should be possible with an ssi block and the correct calles in it.

How to use ssi you can read here
http://docs.simplemachines.org/index.php?topic=400

Title: Re: Counter block
Post by: yjobcreations on March 27, 2007, 01:57:14 PM
it says there that the code is:

trackStats(array('hits' => '+')); trackStats();

but it does not show anything :(
Title: Re: Counter block
Post by: kjb0007 on March 23, 2008, 11:29:52 PM
totally new to installing this type of thing so any and all help is much appreciated. :). I have downloaded the counter that is in the original post, but I am not totally sure what to do next. Could someone please provide me with a step by step walkthru for dummies?  hehhe. I am familiar with TP as far as adding blocks to my portal page, however I have never used one where you also have to upload something to the server.


Thanks in advance :)
Title: Re: Counter block
Post by: b33znutz on July 08, 2008, 07:47:25 AM
installed easy. works perfect. thanks!
Title: Re: Counter block
Post by: thefley on November 16, 2008, 09:33:34 PM
I can not get this one to work for me, I made the directory, made it 777 and put in my URL in the script and I still have no luck.  and ideas?
Title: Re: Counter block
Post by: IchBin on November 17, 2008, 01:17:08 AM
Did you follow the instructions given in the log script README ?