Code: Select all
<?php
$val = file("imagecounter.txt");
$num = $val[0];
$num++;
$fp = fopen( "imagecounter.txt", "w" );
fwrite( $fp, $num );
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
header ("Content-type: image/png");
$img_handle = ImageCreate (400, 110) or die ("Cannot Create image");
$back_color = ImageColorAllocate ($img_handle, 0, 10, 10);
$txt_color = ImageColorAllocate ($img_handle, 255, 255, 255);
ImageTTFText ($img_handle, 9, 0, 5, 20, $txt_color, "/WINDOWS/Fonts/IMPACT.ttf",
"IP : ".$_SERVER['REMOTE_ADDR']);
ImageTTFText ($img_handle, 9, 0, 5, 40, $txt_color, "/WINDOWS/Fonts/IMPACT.ttf",
"HostName : ".$hostname);
ImageTTFText ($img_handle, 9, 0, 5, 60, $txt_color, "/WINDOWS/Fonts/IMPACT.ttf",
"Referer : ".$_SERVER['HTTP_REFERER']);
ImageTTFText ($img_handle, 9, 0, 5, 80, $txt_color, "/WINDOWS/Fonts/IMPACT.ttf",
"User Agent : ".$_SERVER['HTTP_USER_AGENT']);
ImageTTFText ($img_handle, 9, 0, 5, 100, $txt_color, "/WINDOWS/Fonts/IMPACT.ttf",
"You are viewer number $num");
ImagePng ($img_handle);
?>