Version: 2.0
Type: Full Script
Category: HTML
License: GNU General Public License
Description: This counter isn’t like all the other… With this You can choose if You want a image- or text-counter on Your site.
<? ####################################### # PHP IMAGE COUNTER # # Original idea by Lavve # # 2001-06-10 # # New and improved by # # Josh "The Programmer" Pritt # # Sept. 27, 2002 # # # # *********************************** # # Simply use a regular <img> tag in # # the HTML and set the src=<path> # # where <path> is the URL to this # # script. Example: <img # # src=http://me.com/visitCounter.php> # # # # It's easy! # # Email Josh P. for help: # # [email protected] # ####################################### #####* CHANGES REQIRED *##### $cf = "cnt.dat" ; #* The counterfile. #####* Josh P's note: you may need to create this file #####* on the server in the same folder and set its #####* attributes for global write permission. #####* OPTIONAL CHANGES HERE *##### #####* Josh P's note: works fine as is. #####* - only mess with the colors below $height = 14; #* height and width $width = 60; #* of the image #####* NO CHANGES HERE *##### $fp = @fopen($cf, "r") ; $cn = @fread($fp, 255) ; @fclose ($fp) ; $fp = fopen ($cf, "w") ; $cn++ ; fputs ($fp, "$cn") ; fclose ($fp) ; //set up image $im = ImageCreate($width, $height); ##* Here you can set the background and text color $background = ImageColorAllocate($im, 68, 92, 130); $textcolor = ImageColorAllocate($im, 194, 203, 216); //draw on image ImageFill($im, 0, 0, $background); ImageString($im, 4, 1, 1, $cn, $textcolor); //output image Header("Content-type: image/png"); ImagePng($im); //clean up ImageDestroy($im); ?>