Besuche:
$CookieTimeOut = "200"; // Cookie Timeout in Sekunden
$Num_Save_IP = "30"; // IP Adressen die gespeichert werden sollen
$FontTag = "
"; // 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,"w+");
// fputs($Counter,1);
// fclose($Counter);
// $IPF=fopen($IPFile,"w^");
// fputs($IPF,$CurrentIP."#");
// $CurrentCount=1;
//echo "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 "$CurrentCount ";
?>