Просмотр файла image.php

Размер файла: 1.19Kb
<?php
//Script-Name: RastoCounter v1.0
//Coded by Syava aka Rastoman
//Home-Page: http://rastoman.net.ru
//All Right Reserved!!
header('Content-Type: image/gif');
$agent = htmlspecialchars(addslashes(str_replace('::','',$_SERVER['HTTP_USER_AGENT'])));
$addr = htmlspecialchars(addslashes(str_replace('::','',$_SERVER['REMOTE_ADDR'])));
$user = $agent.'::'.$addr;
$day = date('j');
if (file_get_contents('today.dat')!==$day) {
$f = @fopen('users.dat','w+');
@fwrite($f,$user);
@fclose($f);
$fp = @fopen('hits.dat','w');
@fwrite($fp,'1');
@fclose($fp);
$fr = @fopen('today.dat','w');
@fwrite($fr,$day);
@fclose($fr);
} else {
if (strstr(file_get_contents('users.dat'),$user)==false) {
$fp = @fopen('users.dat','a');
@fwrite($fp,file_get_contents('users.dat')."\r\n".$user);
@fclose($fp);
}
$hits = file_get_contents('hits.dat');
@$hits++;
$fr = @fopen('hits.dat','w');
@fwrite($fr,$hits);
@fclose($fr);
}
$str1 = count(file('users.dat'));
$str2 = file_get_contents('hits.dat');
$img = ImageCreateFromGif('image.gif');
$color = ImageColorAllocate($img,0,100,255);
ImageString($img,1,48,8,$str1,$color);
ImageString($img,1,48,24,$str2,$color);
ImageGif($img);
ImageDestroy($img);
?>