<html>
<head>
<title>Iplogger</title>
</head>
<body>
<?php
$fil="/var/www/html/iplog/iplog.txt";
$ip = $REMOTE_ADDR . "\n";
$fila=file($fil);
$fila[0]=$fila[0]+1 . "\n";
$arrayl=count($fila);
echo "The total amount of visits is:$fila[0]</br>
Number of unique ip addresses that have visited this page is: $fila[1]</br></br>
Your ip number is: $ip";
for($i=0;$i<$arrayl;$i++)
{
if($fila[$i]==$ip)
{
$n=0;
echo "<br><br>You have visited " . $fila[$i+1] . " times before.
</br>The last time you was here was: " . $fila[$i+1+$fila[$i+1]] .
"</br>All your visits:</br>";
echo "<pre>";
for($ii=0;$fila[$i+1]>$ii;$ii++)
{
echo $ii+1 . ": " . $fila[$i+$ii+2] . "</br>";
}
echo "</pre>";
$fila[$i+1]=$fila[$i+1]+1 . "\n";
$fila[$i+$fila[$i+1]+1]=date("r") . "\n";
break 1;
}
else
{
$n=1;
}
}
if($n)
{
echo "<br>This is your first time WELCOME";
$fila[1]=$fila[1]+1 . "\n";
$fila[]="\n" . $ip . "1\n" . date("r") . "\n\n";
}
$filh = fopen($fil, 'w+');
foreach($fila as $value)
{
fwrite($filh, $value);
}
fclose($filh);
?>
</body>
</html>