Пеши ф файл:
$f="count.log";
$max_log=10000;
$ip = getIP();
$date = date("H:i:s d.m.Y");
$url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$rows = file($f);
while(count($rows) > $max_log) array_shift($rows);
$rows[] = $date."|".$ip."|".$url."|\r\n";
file_put_contents($f, $rows);
function getIP() {
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{ $ip=$_SERVER['HTTP_CLIENT_IP']; }
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{ $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; }
else { $ip=$_SERVER['REMOTE_ADDR']; }
return $ip;
}