Counters Code

  Home arrow Counters Code arrow simple_hit_counter
COUNTERS CODE

simple_hit_counter
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2002-03-18

    Table of Contents:

     
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement
    A VERY simple hit counter.

    By : sethadam1

    <?php

    /*
    simple_hit_counter
    steps:
    1. create a file hit.txt in the current directory and type a zero as the only character in it.
    If you want to cheat, instead of a zero, use the number you want to start with.
    2. chmod the file to 766.
    3. change the value of the variable $startdate below
    3. insert this script into your web page where you want the hitcounter to be.
    */

    $startdate = ""; # fill this in with a date at which the hitcounter starts, in ANY format
    #(ie. 3/15/02; March 15, 2002; or 3.15.2002)

    if (empty($startdate)) { $startdate = "rollout"; }

    $currenthits = @file_get_contents("hit.txt");
    if($currenthits) {
    $currenthits++;
    echo $currenthits." hits since ".$startdate;
    $fh = @fopen("./hit.txt", "w");
    if ($fh) {
    fwrite($fh, $currenthits);
    fclose($fh);
    }
    }

    ?>
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Counters Code Articles
    More By Codewalkers

    blog comments powered by Disqus

    COUNTERS CODE ARTICLES

    - TG Who's Online
    - Text Based Counter that formats output
    - Counter & visitor statistics
    - Server Uptime Statistics
    - Chris Dingman's Hit Tracker Script
    - Graph Maker Function
    - Simple userOnline class
    - Adv. Log file generator
    - Logwriter
    - time_left()
    - Basic Statistics
    - Easy Counter
    - countCodeLines
    - MySQL Counter
    - bandwidthmeter

    Developer Shed Affiliates

     



    © 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap