1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Simple Hit counter script

Discussion in 'General Programming Chat' started by s-c-0-r-p-i-a-n, Aug 28, 2011.

  1. s-c-0-r-p-i-a-n

    s-c-0-r-p-i-a-n BANNED BANNED

    Joined:
    Nov 20, 2010
    Messages:
    37
    Likes Received:
    2
    Bellow is an example of a simple hit counter script i wrote for hostwoot.

    Code:
    <?php
    if(file_exists("hits.txt")){
    $hits = file_get_contents("hits.txt") + 1;
    }else $hits = 1;
    $fp = fopen("hits.txt", "w+");
    fwrite($fp, $hits); 
    fclose($fp);
    print $hits; 
    ?>