
LEBEKIN JA NICKELIN KEVÄÄN TAKIT

ANNA MONTANAN KEVÄÄN HOUSUT
SIGNATURE JENSEN KEVÄTMALLISTO
$expire= 1300; // ip expires after $expire seconds
$logfile= "flount.log"; // file where visits and ip logs are stored
// *************************** don't change anything below this line *************************
$incpath=substr(__FILE__, 0, strrpos(__FILE__, "/")+1);
$logfile=$incpath.$logfile;
$ip= getenv('REMOTE_ADDR');
$visits=0;
$badhit= false;
$now= time();
$ips = array(array());
if (file_exists($logfile)){
if ($loggedips=file($logfile)){
$visits=trim($loggedips[0]);
for ($i=1; $i< count($loggedips); $i++){
$loggedips[$i]=trim($loggedips[$i]);
$ips[$i] = explode('||', $loggedips[$i]);
if (($ips[$i][0]==$ip) && ($now-$ips[$i][1]< $expire))
$badhit= true;
}
if ($badhit)
{}
else{
$visits++;
$fp= fopen($logfile, 'w');
fputs($fp,"$visits\n");
for ($i=1; $i< count($loggedips); $i++){
if ($now-$ips[$i][1] < $expire)
fputs($fp, $ips[$i][0]."||".$ips[$i][1]."\n");
}
fputs($fp, "$ip||$now\n");
fclose($fp);
}
}
}
?>