
Originally Posted by
syhs89
anyway,
who can tell me why
Front Page's
web components
didn't work here?
for example,
my counter here...
i can just see [My counter]
in the location i put the web component....
any one know why??
make counter with php gd lib. Front Page components(include counters) - sux :)
Here is code. Sorry, but comments in Russian :D If you don't understand anything, i can translate :)
----- file: counter.php ------- use [img]counter.php[/img]
Code:
<?
$dat_file="includes/counter/counter.dat"; // Файл счетчика
$log_file="includes/counter/counter.log"; // Файл списка IP
// Открывем файл счетчика и считываем текущий счет
// в переменную $count
$f=fopen($dat_file,"r");
$count=fgets($f,100);
fclose($f);
$count=ereg_replace(" ","",$count); // Удаляем символ конца строки
$count++; // Увеличиваем счетчик
// Записываем данные обратно в файл
$f=fopen($dat_file,"w");
fputs($f,"$count ");
fclose($f);
// Создаем новое изображение из файла
$im = ImageCreateFromPNG('images/counter.png');
// Назначаем черный цвет
$black = ImagecolorAllocate($im,0,0,0);
// Выводим счет на изображение
Imagestring($im,1,5,20,$count,$black);
// Выводим изображение в стандартный поток вывода
Header("Content-type: image/png");
ImagePng($im);
// Записываем IP посетителя
$f=fopen($log_file,"a+");
$ip=getenv("REMOTE_ADDR");
fputs($f,"$ip ");
fclose($f);
?>
Bookmarks