if (isset($_GET))
{
foreach ($_GET as $key=>$value)
{
$anchor = $key;
break;
}
$IP = $_SERVER["REMOTE_ADDR"];
if (!file_exists("./stats-ip.dat"))
{
$fp = fopen("./stats-ip.dat","a+");
$puts = $IP."::".$anchor."\n";
}
else
{
$file = file("./stats-ip.dat");
$file1 = "./stats-ip.dat";
$file2 = "./admin/stats-bak.dat";
if (@filesize($file1 >= $file2))
copy ($file1,$file2);
if (!in_array($IP,$file))
{
$file[] = $IP."::".$anchor."\n";
$puts = implode("",$file);
}
else
{
$puts = '';
foreach ($file as $value)
{
echo $IP;
if(preg_match("!".$IP."!",$value)) // Вот здесь уже IP пропал!!!
{
echo "Match!";
$puts .= trim($value)." ".$anchor."\n";
}
else
$puts .= $value;
}
}
$fp = fopen("./stats-ip.dat","r+");
}
fputs($fp,$puts);
fclose($fp);
}