# Hidden Counter CGI # Rename this file to have a .cgi extension! # © 2003 Paz Itzhaki-Weinberger - http://www.pazcorp.com # # This cgi increments a counter in a file, then returns a gif image. # (use either a small, 1-pixel "invisible" image, or any other pic.) # HTML code to call this: # # # # This is good to be used as a "hidden" counter within a webpage. # # Note: Be sure that the counter file is set WRITABLE by the httpd # daemon owner or group. in Unix you'll need to 'chmod 775 countfile' # or possibly 'chmod 777 countfile'. #Name of countfile $countfile = "cgicount"; #Name of giffile to display $giffile = "small.gif"; $count = `cat $countfile`; chop($count); $count = $count + 1; open(INF,">$countfile"); print INF "$count\n"; close(INF); # if you're using a JPEG instead of a GIF, you should change this # line to print type image/jpg and also change the giffilename above. print "Content-type:image/gif\n\n"; @gifdata = `cat $giffile`; print @gifdata;