Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Looking for a fast and reliable page hits script

    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.

  • #2
    Regular Coder
    Join Date
    Jul 2003
    Location
    Singapore
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi, i have a counter script, maybe u can try:
    PHP Code:
    <?php
    session_start
    ();
    $counter 'counter.txt';
    $handle fopen($counter"r+");
    $content fread($handlefilesize($counter));
    if(!isset(
    $_SESSION['counter'])){
        
    $content++;
        
    rewind($handle);
        
    fwrite($handle$content);
        
    $_SESSION['counter'] = 1;
    }
    fclose($handle);
    ?>

  • #3
    Registered User
    Join Date
    Jun 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks qazs, but I can't use it if it doesn't check for unique visitors.

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,454
    Thanks
    0
    Thanked 632 Times in 622 Posts
    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.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    Registered User
    Join Date
    Jun 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by felgall
    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!

  • #6
    Registered User
    Join Date
    Jun 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ha, I thought you guys were talented, you can't even come up with a simple counter script! What a losers

  • #7
    Regular Coder
    Join Date
    Nov 2003
    Location
    Vancouver Island Canada
    Posts
    139
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by JohnD
    Ha, I thought you guys were talented, you can't even come up with a simple counter script! What a losers
    Boy that attitude will get you lots of help."NOT!!!!!"

  • #8
    Regular Coder
    Join Date
    Oct 2004
    Location
    London E4 UK
    Posts
    320
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by JohnD
    Ha, I thought you guys were talented, you can't even come up with a simple counter script! What a losers
    nice attitude fella, that's gonna help the job get done

  • #9
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Looking for a fast and reliable page hits script
    1. 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.
    2. 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.
    3. 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.
    4. 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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •