PHPBuilder - Chris Dingman's Hit Trackter Script



RSS Twitter
Snippets Other

Chris Dingman's Hit Trackter Script

by: Chris Dingman
|
July 28, 2004

Version: 1.0

Type: Full Script

Category: Other

License: GNU General Public License

Description: A short script that allows users to track visitors to their site.



<?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
?>

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Chris Dingman

Comment:



Comment:

(Maximum characters: 1200). You have characters left.