PHP hit counter - bug/problem

In case you have problems with some other PHPJunkyard script (not that there are THAT many).
Post Reply
WayneM
Posts: 2
Joined: Wed Feb 01, 2006 11:41 pm

PHP hit counter - bug/problem

Post by WayneM »

Script URL:
Version of script: Version: 1.0
Version of PHP:
Hosting company:
Have you searched THIS FORUM for your problem: yes
(if not please do before posting)
If so, what terms did you try:

Write your message below:

I've installed PHP hit counter and it works fine. Thanks! :D

However, here's a problem that might need some looking into.

It seems that if you enter the url of the script in a browser,
ex: http/www.yourwebsite.com/counter.php

The script will execute and increase the log counter.

If someone really wants to be a pest, they can enter urls like:
http/www.yourwebsite.com/counter.php?page=index1
http/www.yourwebsite.com/counter.php?page=index2
http/www.yourwebsite.com/counter.php?page=index3
http/www.yourwebsite.com/counter.php?page=index4
http/www.yourwebsite.com/counter.php?page=index5
and so on....

That will create .log files on your server.

I've correctly enabled the HTTP referer validation in the script, and it still allows this kind of direct url abuse.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

If no HTTP referer is set the counter will allow execution (because many browsers can be setup not to give away HTTP referer info), but you can disable that by changing

Code: Select all

	if ($check_referer == 1 && !(empty($_SERVER['HTTP_REFERER'])))
	{
		check_referer($_SERVER['HTTP_REFERER']);
	}
to

Code: Select all

	if ($check_referer)
	{
		check_referer($_SERVER['HTTP_REFERER']);
	}
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
WayneM
Posts: 2
Joined: Wed Feb 01, 2006 11:41 pm

Thanks!

Post by WayneM »

Excellent.

Thank you again for the great script and your helpful support :-)
Post Reply