Results 1 to 4 of 4

Thread: Hit Counter?

  1. #1
    Join Date
    Jan 2007
    Location
    Blackburn
    Posts
    426
    Tokens
    0
    Habbo
    ChampJames

    Default Hit Counter?

    I need a hit counter for my website, but I dont want to use one of these free ones that you have to include an advert with.

    Could anybody supple me with the code that I can use to get a hit counter to appear on my page, or link me to a website that offers such a service.
    HabTunes - Coming Soon!

    Interested in a job? PM me!

  2. #2
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Here an basic PHP one which I normally use:
    PHP Code:
    <?php
    $document 
    = ("hits.txt");
    $hits file($document);
    $hits[0] ++;
    $fp fopen($document "w+");
    fputs($fp "$hits[0]");
    fclose($fp);

    echo(
    "The Message you want showed: $hits[0]");
    ?>
    Create an .txt file called hits.txt and change the permissions to 777 .

  3. #3
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    Its simple to make a php counter;

    make a file called counter.txt, write the number "1" in it and save it.

    Then make a file called counter.php and add this code to it;

    PHP Code:
    <?php

    $filename 
    "counter.txt";
    $fd fopen ($filename"r");
    $contents fread ($fdfilesize($filename));
    fclose ($fd);
    $contents=$contents+1;
    echo 
    $contents;

    $fp fopen ($filename"w")
    fwrite ($fp,$contents);
    fclose ($fp);
    ?>
    Now use a php include to include counter.php to your website
    Lets set the stage on fire, and hollywood will be jealous.

  4. #4
    Join Date
    Jan 2007
    Location
    Blackburn
    Posts
    426
    Tokens
    0
    Habbo
    ChampJames

    Default

    thanks.
    HabTunes - Coming Soon!

    Interested in a job? PM me!

Posting Permissions

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