<?
$CookieTimeOut = "400"; // Cookie Timeout in Sekunden
$Num_Save_IP = "80"; // IP Adressen die gespeichert werden sollen
$FontTag = "<font size=2 face=arial color=#ffffff>"; // Schrifteinstellungen fonttag
$IPFile = "IPs.dat"; // Datei in der die IPs gespeichert werden sollen
$LogFile = "Stat.dat"; // Datei in der die Counterdaten gespeichert werden.
$CurrentIP=$REMOTE_ADDR;
if(file_exists($IPFile))
{
$IPF=fopen($IPFile,"r+");
$IPData=fgets($IPF,2000);
$IPArray=explode("#",$IPData);
if(in_array($CurrentIP,$IPArray))
{
$Action="read";
}
else
{
$SavedIPs=count($IPArray);
if($SavedIPs<=$Num_Save_IP)
{
fputs($IPF,$CurrentIP."#");
fclose($IPF);
$Action="update";
}
else
{
$arrayp=array_pop($IPArray);
$IPArray=array_reverse($IPArray);
array_push($IPArray,$CurrentIP);
$IPArray=array_reverse($IPArray);
$AddIP=implode("#",$CurrentIP);
$IPF=fopen($IPFile,"w+");
fputs($IPF,$CurrentIP);
fclose($IPF);
$Action="update";
}
}
}
else
{
$Counter=fopen($LogFile,"w+");
fputs($Counter,1);
fclose($Counter);
$IPF=fopen($IPFile,"w^");
fputs($IPF,$CurrentIP."#");
$CurrentCount=1;
}
if($Action=="update")
{
$Counter=fopen($LogFile,"r+");
$CurrentCount=fgets($Counter,20);
$CurrentCount++;
fseek($Counter,0);
fputs($Counter,$CurrentCount);
fclose($Counter);
}
if($Action=="read")
{
$Counter=fopen($LogFile,"r+");
$CurrentCount=fgets($Counter,20);
fclose($Counter);
}
echo "<html><body>$FontTag Du bist Visitor Nr. <b>$CurrentCount </b>";
?>