Counters Code

  Home arrow Counters Code arrow Chris Dingman's Hit Tracker Script
COUNTERS CODE

Chris Dingman's Hit Tracker Script
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2004-07-28

    Table of Contents:

     
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement
    A short script that logs visitors to your site by storing information such as IP, Referring URL and query string in a tab (or other character) delimited text file.

    By : dinger

    <?PHP
    ##################################################
    #Chris Dingman's Hit Tracker
    #Version 1.1
    #Copyright Chris Dingman 2004 All Rights Reserved
    #This script is distributed as shareware. If you use this script, please be sure to register your copy.
    #To register, please send $10 check or money order, along with your name and email address to:
    #
    #Chris Dingman
    #B20 Bayshore Drive
    #South Amboy NJ 08879
    #
    #By registering you are signing up for notices regarding updates and new scripts and you help make this script possible.
    #If you have any questions about installation, please email chrisdingman@yahoo.com.
    #Hit tracking header file
    #To use this script, simply include it at the top of all of your .php files on your site. It will create a log text file. Before you do, please be sure to modify the necessary variables below.
    #For security purposes, it is recomennded that you store the log file in a non-web accessible directory. You may also wish to make this file non-web accessible as well, but it is not necessary.
    #This script should never produce any output to the browser. It is intended solely to log hits to your site.
    ##################################################

    #VARIABLES TO BE MODIFIED

    #UNIX Path to Data file - should be non-web accessible if at all possible.
    $pathToDataFile = "/usr/local/www/net-cabarett/data/hits.txt";
    #Date format. If unsure of how to set it, don't touch it. For more info on how to set it, visit http://us2.php.net/manual/en/function.date.php
    $todaysDate=date("D M j g:ia");
    #Column separator. Recommended to be a tab or a space but can be anything you want. Leave as a tab to create a tab-delimited file.
    $separator = "\t";

    #END OF VARIABLES

    #Start of script

    #Opens log file for writing
    $FilePointer=@fopen($pathToDataFile,"a");

    #Creates record
    $message = $_SERVER['REMOTE_ADDR'].$separator.$todaysDate.$separator.$_SERVER['PHP_SELF'].$separator.$_SERVER['HTTP_USER_AGENT'].$separator.$_SERVER['HTTP_REFERER'].$separator.$_SERVER['REMOTE_HOST'].$separator.$_SERVER['QUERY_STRING']."\n";

    #writes record to log file
    @fwrite($FilePointer,$message);

    #closes log file
    @fclose($FilePointer);

    #END OF SCRIPT
    ?>u
    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