...

View Full Version : Looking for a fast and reliable page hits script



JohnD
10-02-2005, 02:17 AM
Hi,

Iím looking for a simple page hits script. I donít know how to write scripts otherwise I would have written one myself.
The purpose of this script is to count how many times a visitor visited a single page, in this case how many times the page was viewed.
The result should be visible on that same page. Itís like those tutorial sites that show you how many times a tutorial was viewed.

I used a script called csCounter, but that one was too slow.

I need a script that can handle 20,000-40,000 visitors on a single page on peak day with ease. The script I used couldnít, it would almost send the server into a meltdown. The reason why it couldnít handle it (in my opinion) was the large IP list, a text file of 1,7MB.

Iíve searched for 3 days all over the internet, but couldnít find anything useful. Either the scripts donít check for unique visitors, they are too slow or they count a lot of other things that I really donít need.

Requirements of the script:

- It should be really fast; on peak days days it should be able to handle 20,000-40,000 page hits on the same page
- It should be reliable (my old script would reset a counter once in a while)
- It should have a simple check for unique visitors

My Unix server supports Perl, PHP and MySQL.

Does anyone know of such a script that can meet these requirements? Whether itís a CGI, PHP script pr MySQL or Text file based, as long as it does what I want it to do.

I appreciate your help.

John.

qazs
10-02-2005, 11:46 AM
hi, i have a counter script, maybe u can try:


<?php
session_start();
$counter = 'counter.txt';
$handle = fopen($counter, "r+");
$content = fread($handle, filesize($counter));
if(!isset($_SESSION['counter'])){
$content++;
rewind($handle);
fwrite($handle, $content);
$_SESSION['counter'] = 1;
}
fclose($handle);
?>

JohnD
10-02-2005, 02:00 PM
Thanks qazs, but I can't use it if it doesn't check for unique visitors.

felgall
10-02-2005, 11:17 PM
How do you propose to identify unique visitors?

Cookies will work provided that your visitors allow them to be saved.

IP addresses will approximate the result you want but selecting the appropriate time period after which the IP address is considered a new visitor can be difficult.

JohnD
10-02-2005, 11:55 PM
How do you propose to identify unique visitors?

Cookies will work provided that your visitors allow them to be saved.

IP addresses will approximate the result you want but selecting the appropriate time period after which the IP address is considered a new visitor can be difficult.Oops, I didn't think I needed to explain that I don't want just a dumb counter=counter+1 script, but at least some test for unique visitors if I don't want to have rediculous numbers. Doesn't have to be 100% accurate of course! :rolleyes:

JohnD
10-04-2005, 01:27 PM
Ha, I thought you guys were talented, you can't even come up with a simple counter script! :D What a losers :rolleyes:

glenmac
10-04-2005, 02:12 PM
Ha, I thought you guys were talented, you can't even come up with a simple counter script! :D What a losers :rolleyes: Boy that attitude will get you lots of help."NOT!!!!!"

Tynan
10-04-2005, 02:13 PM
Ha, I thought you guys were talented, you can't even come up with a simple counter script! :D What a losers :rolleyes:

nice attitude fella, that's gonna help the job get done

Fou-Lu
10-04-2005, 03:54 PM
Looking for a fast and reliable page hits script


You have been provided with exactly what has been requested by qazs. Unique visitors are not the same as page hits, and therefore your 'I didn't think I needed to explain that I don't want just a dumb counter=counter+1 script' is an inaccurate comment, you need to explain what you request, especially if it differs from your title.
Please remember that we are here to donate our time to help others. If your request is not posted within a day or two, don't become so agressive. Be patient and should your request become un-noticed then perhaps ask if anyone has a clue. Often times threads are easily missed.
Please identify a method you would like to use. Your request is too generic. This can be done with Javascript, java, Perl, PHP, ASP, VB, and possibly XML (with combined methods). The best route would be to identify a language you would like to use/can use and post within its perspective forum.
The others are right as well, rude and agressive posts will get you nowhere, and tend to impede on future requests.

That is all I have to say.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum