$CookieTimeOut = "200"; // Cookie Timeout in Sekunden $Num_Save_IP = "10"; // IP Adressen die gespeichert werden sollen $IPFile = "IPs.dat"; // Datei in der die IPs gespeichert werden sollen $LogFile = "counter.log"; // 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 { $IPF=fopen($IPFile,"w^"); fputs($IPF,$CurrentIP."#"); fclose($IPF); } if($Action=="update") { $file = "counter.log"; $counter = fopen($file,"r"); $string = fread($counter, filesize($file)); fclose($counter); $zahl = intval(substr($string,6)); $zahl++; $counter = fopen($file, "w+"); $string = fwrite($counter, "&zahl=".($zahl)); fclose($counter); } if($Action=="read") { $file = "counter.log"; } ?>