SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    Apr 2000
    Posts
    1,483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does your server support ASP or PHP?
    If so you could make a simple script that stores the number of visitors in a text file or database, and then the secret page could just display the current contents of the text file or database.

    I dont think there are any pre-written scripts etc that already do that.

    ------------------
    James Ussher-Smith, jamesus@lineone.net
    ICQ: 41716548
    640 Kilobytes of computer memory ought to be enough for anybody. - Bill Gates, 1981



    [This message has been edited by James (edited August 09, 2000).]

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Location
    Peterborough, England
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have had a good response for places to get hit counters from online and their uses, but, please, does anyone know how to: ‘put a hit counter on a different page to the page I am trying to count traffic for?’ – ie. I would love to have a hit counter on my web site, but I do not want visitors seeing that there have only been 10 visitors, or indeed whether there have been 1000. I do not really want to use a hidden counter on a page, I would like a page within my web site that only I know of, that I can visit to see how many people have been to my homepage.

    If this cannot be done, can someone explain why? And what would be the next best thing?

    Basically – I want a hit counter for my homepage and I want to be the only one to see it.

  3. #3
    SitePoint Enthusiast GodFather's Avatar
    Join Date
    Aug 2000
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if your index page is cgi-generated this will be even easier, you could just use this code right here:

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
    $filename = "/server/path/to/hits.log";
    if (!(-e $filename)) {
    open (STATS, "&gt;$filename");
    print STATS "1";
    close (STATS);
    }
    else {
    open (STATS, "$filename");
    @data = &lt;STATS&gt;;
    close(STATS);
    $data[0]++;
    open (STATS, "&gt;$filename");
    print STATS "$data[0]";
    close(STATS);
    }
    [/code]

    and then you could make a small cgi file with this in it to read the file:

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
    $filetoopen = "/server/path/to/hits.log";
    open(FILE,"$filetoopen");
    $hits = &lt;FILE&gt;;
    close(FILE);

    if (!(-e $filetoopen)) {
    $hits = 0;
    }
    [/code]

    if you need any more explanation let me know


Bookmarks

Posting Permissions

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