Results 1 to 3 of 3
  1. #1

    Best way to make a click counterq

    I know of to ways to do this, but haven't decide wich one to use. I don't know if one is better than the other.

    PHP Code:

    // Script that counts one more click and stores this to the DB

    header("Location: $url");
    PHP Code:

    // Script that counts one more click and stores this to the DB

         <meta HTTP-EQUIV="REFRESH" CONTENT="0;URL=<?php echo $url?>">
    Do you know of another way? Pros and Cons of this methods, any suggestion will be appreciated.

  2. #2
    Join Date
    Mar 2004
    i always like to be on the html side...

    so maybe the meta refresh sounds more reliable, but it will show that it is redirecting somehow, unlike the straight header, which redirects in a split second..

    Testing 1.. Testing 1..2.. Testing 1..2..3...

  3. #3
    Join Date
    Aug 2002
    Hong Kong
    1 will be better, its a 301 redirect, it tells the browser to "hey, get it in another url xxx" and the browser will load the new url right away

    while 2 is a 200 status ok, like this "hey, what you want is right here", but the meta tag the browser reads later tells it "please reload this page with this url xxx in xx seconds", though you can set it to 0 sec, but while the browser requests the new page, the old one may still be loading, in you log it shows 2 hits

Posting Permissions

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