Просмотр файла php-stats/log.php

Размер файла: 836B
<?


/*
			*****************************************
			*	Autor: Alpha			*
			*	Name PHP script stats WebSite	*
			*	Last modificed: 3.11.03 	*
			*	Contact: [email protected]	*
			*	All rigiht resaved 		*
			*****************************************
*/

// статистика
$sf ="stat.dat"; 
$fpsf=fopen($sf,"a+"); 
$ip=getenv("REMOTE_ADDR"); 
$ag=getenv("HTTP_USER_AGENT"); 
$from=getenv("HTTP_REFERER"); 
$host=getenv("REQUEST_URI"); 
$date = date("d.m.y"); 
$time= date("H:i:s"); 
fputs($fpsf,"$date#$time#$ip#$ag#$from#$host\n"); 
fclose($fpsf); 

// счетчик
$cf = "cont.dat"; 
$fpcf=fopen($cf,"r"); 
if ($fpcf) { 
$counter=fgets($fpcf,10);  
fclose($fpcf); 
} else { 
$counter=0; 
} 
$counter++; 

$fpcf = @fopen($cf,"w"); 
if ($fpcf) { 
$counter=fputs($fpcf,$counter); 
fclose($fpcf); 
} 
?>