Showing posts with label Graphic counter. Show all posts
Showing posts with label Graphic counter. Show all posts

Tuesday, August 3, 2010

Graphic counter

Graphic counter. 
!!! Dont forget to create count.txt file and cmod 777
if your server does not support Gif image create, use png image create.
Replace 
header('Content-Type: image/GIF');
ImageGIF ($im);

with
header('Content-Type: image/PNG');
ImagePNG ($im);

thats all

PHP Code:
// Image Counter Scriptif(!file_exists("count.txt"))
{
$counter=fopen("count.txt", "a");}
else
{
$counter=fopen("count.txt", "r+");}$aufruf=fgets($counter,100);$aufruf=$aufruf+1;rewind($counter);fputs($counter,$aufruf);fclose($counter);$im = @ImageCreate (99, 46) //change the image size hereor die ("Kann keinen neuen GD-Bild-Stream erzeugen");$background_color = ImageColorAllocate ($im, 255, 255, 255);$text_color = ImageColorAllocate ($im, 255, 0, 0);ImageString ($im, 2, 1, 1, "$aufruf", $text_color2); header('Content-Type: image/GIF');ImageGIF ($im);?>