Mega Code Archive

 
Categories / Php / Statistics and Counters
 

Tracker Script

<?PHP #VARIABLES TO BE MODIFIED #UNIX Path to Data file - should be non-web accessible if at all possible. $pathToDataFile = "www.xxx"; $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