<?php
if (isset ($HTTP_X_FORWARDED_FOR)) 
{ 
$host = gethostbyaddr($HTTP_X_FORWARDED_FOR); 
}else{ 
$host = gethostbyaddr($REMOTE_ADDR); } 

$ip=getenv('REMOTE_ADDR');
$date=date('d M Y, H:i:s');
$host1=gethostbyaddr("$ip");

$str=("
Дата - $date
Хост - $host
IP-адрес - $ip
---------------------");
$fp=fopen("report","a+");
fputs("$fp","$str");
fclose($fp);
?>