> http://www.punyu.net/ //---------- 設定 // カウンタ記録ファイル $logfile = 'count.dat'; // フォントサイズ(小 1 〜 5 大) $font = 5; // 文字色(必ず16進数で) $mcolor = '000000'; // 背景色(必ず16進数で) $bcolor = 'FFFFFF'; // カウンタの桁数 $fig = 6; //---------- 設定ここまで header ("Content-type: image/gif"); $fp = fopen($logfile,"r+"); flock($fp, 2); $count = fgets($fp,256); $lastIP = fgets($fp,256); $IP = getenv("REMOTE_ADDR"); $count = chop($count); if($lastIP != $IP){ $count++; ftruncate($fp,0); rewind($fp); fwrite($fp, $count); fwrite($fp, "\n"); fwrite($fp, $IP); } fclose($fp); $string = sprintf("%0".$fig."d", $count); $width = imagefontwidth($font) * strlen($string); $height = imagefontheight($font); $im = imagecreate($width,$height); $back = imagecolorallocate($im, hexdec(substr($bcolor,0,2)), hexdec(substr($bcolor,2,2)), hexdec(substr($bcolor,4,2))); $moji = imagecolorallocate($im, hexdec(substr($mcolor,0,2)), hexdec(substr($mcolor,2,2)), hexdec(substr($mcolor,4,2))); imagestring($im, $font, 0, 0, $string, $moji); imagegif($im); imagedestroy($im); ?>