Размер файла: 694B
<?php
function c() {
$h = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ?
$_SERVER['HTTP_X_FORWARDED_FOR'] :
$_SERVER['REMOTE_ADDR'];
$a = $h.'|'.$_SERVER['HTTP_USER_AGENT']."\n";
date_default_timezone_set('Europe/Moscow');
$d = date('dmY');
$b = 'a';
$e = "0:$d\n";
$c = file_exists($b) ? file($b) : array($a, $e);
array_unshift($c, $a);
$e = array_pop($c);
$e = explode(':', $e, 2);
$f = $e[1];
$g = $e[0];
$e = ++$g.":$d\n";
$c[] = $e;
$c = array_unique($c);
if ("$d\n" == $f) {
file_put_contents($b, $c, LOCK_EX);
return array(count($c)-1, "$g");
}
unlink($b);
file_put_contents($b, array($a, "1:$d\n"), LOCK_EX);
return array(1, 1);
}
?>