gcounter doesnt display the numbers on a page.

In case you have problems with some other PHPJunkyard script (not that there are THAT many).
Post Reply
EPurpl3
Posts: 4
Joined: Fri Oct 25, 2013 10:24 am

gcounter doesnt display the numbers on a page.

Post by EPurpl3 »

Script URL: http://www.phpjunkyard.com/php-graphica ... ounter.php
Version of script: 1.3
Hosting company: newhost.ro
URL of session_test.php: http://commonroots.ro/counter/gcount.php?page=test
What terms did you try when SEARCHING for a solution: "gcounter not working" "gcounter display on everypage" "gcounter fix", etc.

Write your message below:

Hello, i have 2 questions about gcounter.

1. I am trying to use gcounter, i took all the necessair steps but it doesnt work, the counter doesnt display the views. So:

I have moved all the required files in the proper folder. When i am using the following address to my website the counter counts the views:

http://commonroots.ro/counter/gcount.php?page=test

Even when i use this (i have created the text file for the index):

http://commonroots.ro/counter/gcount.php?page=index

I have edited the gcounter.php file:

Code: Select all

$base_url = 'http://www.commonroots.ro/counter/';
I have copy/pasted

Code: Select all

<script language="Javascript" src="http://www.site.com/counter/gcount.php?page=test"><!--
//--></script>
into a div so i got this:

Code: Select all

<div id="home-59"><script language="Javascript" src="http://www.commonroot.ro/counter/gcount.php?page=index"></script></div>
i have also tested the link in the beginning of the page without success, it simply doesnt show the numbers.





2. The second question is: it is possible to use the counter to count the views only on index.html but to display the result on all the other pages.
Klemen
Site Admin
Posts: 10114
Joined: Fri Feb 11, 2005 4:04 pm

Re: gcounter doesnt display the numbers on a page.

Post by Klemen »

1. The script works correctly here:
http://commonroots.ro/counter/gcount.php?page=test

It also works fine if I test it on a simple HTML page (save this as "test.html" and try):

Code: Select all

<html>
<body>
<script language="Javascript" src="http://commonroots.ro/counter/gcount.php?page=test"><!--
//-->
</script>
</body>
</html>
This means the problem is on the page you are trying to display count. Most likely the page is generating some Javascript errors (not related to GCount) and the browser stops executing all Javascript because of the error.

2. You can change this in gcount.php

Code: Select all

if ( $count_unique == 0 || ! isset($_COOKIE[$cname]) )
to

Code: Select all

if ( ! isset($_GET['nocount']) && ( $count_unique == 0 || ! isset($_COOKIE[$cname]) ) )
Then you would add &nocount=1 after "page=test" and it will only display count, but not count it.

For example after making the modification try
http://commonroots.ro/counter/gcount.ph ... &nocount=1
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
EPurpl3
Posts: 4
Joined: Fri Oct 25, 2013 10:24 am

Re: gcounter doesnt display the numbers on a page.

Post by EPurpl3 »

Thanks for the answer but unfortunately, after i have removed all the js and php from the page (except gcounter), the counter still doesnt show the numbers :(.


Then you would add &nocount=1 after "page=test" and it will only display count, but not count it.
But this will just display the counter on all pages without counting it but also works to just count only index.php page but to display the counter on all other pages?

I want to display the counter on all the pages in the website but to count only the first page.

Thanks.
Klemen
Site Admin
Posts: 10114
Joined: Fri Feb 11, 2005 4:04 pm

Re: gcounter doesnt display the numbers on a page.

Post by Klemen »

The test HTML code I posted in my previous reply works fine, so there is nothing wrong with the script. What the exact problem is on your page is something you will need to troubleshoot yourself I'm afraid.

On index.php use the normal code and on any page you just want to display digit but not count add "&nocount=1"
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
EPurpl3
Posts: 4
Joined: Fri Oct 25, 2013 10:24 am

Re: gcounter doesnt display the numbers on a page.

Post by EPurpl3 »

Ok, thank you very much, i have one more question, should i add "&nocount=1" to the link to the other pages, from example, on the hyperlink instead of "news_ro.php" should i add "news_ro.php?page=test&nocount=1"


So if i want to add the counter on the index page do i have to write

http://commonroots.ro/index.php?page=test

or should the counter work if i only write http://commonroots.ro?

Sorry, i have never used the "?page=xxx" stuff before.

Thank you.
Klemen
Site Admin
Posts: 10114
Joined: Fri Feb 11, 2005 4:04 pm

Re: gcounter doesnt display the numbers on a page.

Post by Klemen »

I'm not sure you are using the script correctly.

You do not have to do any modifications to your existing URLs.

If you want to COUNT VISITS on a page:

1. Create a *.txt file inside "logs" folder. Name it example.txt - for example if you count the index page you could name it "index.txt", if you count "Contact us" page you can create "contact.txt". Any name you want.

2. On the page where you want to count visits add this code - replace "example" with the txt file name:

Code: Select all

<script language="Javascript" src="http://commonroots.ro/counter/gcount.php?page=example"><!--
//-->
</script>
For example if you created file "contact.txt", you would use this code:

Code: Select all

<script language="Javascript" src="http://commonroots.ro/counter/gcount.php?page=contact"><!--
//-->
</script>
If you created file "index.txt" you would use:

Code: Select all

[code]<script language="Javascript" src="http://commonroots.ro/counter/gcount.php?page=index"><!--
//-->
</script>
[/code]

And so on. The "?page=" parameter just tells the counter in which file to save the count number. The src url is always your "gcount.php" file.



So, you DO NOT edit your index.php URL, you just add THE ABOVE CODE to your index.php file.

If you are not sure how to do that, see this tutorial:
http://www.phpjunkyard.com/tutorials/cut-paste-code.php


Is this a bit more clear now? If you figure this out let me know, then it is just a small change to show the count but not count visits.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
EPurpl3
Posts: 4
Joined: Fri Oct 25, 2013 10:24 am

Re: gcounter doesnt display the numbers on a page.

Post by EPurpl3 »

Yes, thats what i have done but i was really unable to find the problem and i thought that maybe i do something wrong regarding the ?page=test because thats something new for me.

Btw, i have already read "Cut and paste code" forum :)

The strangest part is that this works find in another html but not in "the" html. I have even deleted everything from the page, except the div and the meta. Could be a problem related with the html meta?

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
I was thinking to use a iFrame to display the counter in the pages that does not have to be counted but than it wont work to count the index page.

A friend will help me with the counter but i will still try to find a solution for this one. I will tell you if i find a solution and what was causing the problem, if i find the solution.

Thank you very much.
Post Reply