<?php

 # Counter/1.0

 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
 ## stash it away in the log file
 ## this section was written by bradley g
 ## it mimics the 'combined' log file format in some ways
$logfile = fopen("log.txt", "a");
fputs($logfile, getenv("REMOTE_ADDR") . " - - ");
fputs($logfile, "[" . date("d/M/Y:H:i:s", time()) . " +0000] ");
fputs($logfile, "\"" . getenv(REQUEST_METHOD) . " ");
fputs($logfile, getenv("REQUEST_URI") . " ");
fputs($logfile, getenv("SERVER_PROTOCOL") . "\" 200 0 ");
fputs($logfile, "\"" . getenv("HTTP_REFERER") . "\" ");
fputs($logfile, "\"" . getenv("HTTP_USER_AGENT") . "\" ");
fputs($logfile, "\n");
fclose($logfile);

 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
 ## send headers
 ## this makes sure it gets reloaded
 ## and that this appears as an image
@Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");              // Date in the past
@Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
@Header("Cache-Control: no-cache, must-revalidate");            // HTTP/1.1
@Header("Pragma: no-cache");                                    // HTTP/1.0
@Header("Content-type: image/gif");

 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
 ## send them the image content
readfile("counter.gif");

?>

