// Variabili // ==================================== $count=1; // Step counter $ip=getenv("REMOTE_ADDR"); // IP Address remoto $counterfile="counter.txt"; // file di output $reloadsperre = FALSE; // Reload no (TRUE) o si (FALSE); // scrive nel file di output // il conteggio e l'ip // ==================================== if (!file_exists($counterfile)) { if ($datei=fopen($counterfile,"a")) { $inf = $count." : ".gethostbyaddr($ip)." : ".date("d/m/Y H:i:s")."\n"; fputs($datei,$inf); fclose($datei); } else { return; } } else { $fcontents = file($counterfile); while(list($nlinea,$linea) = each($fcontents)) { list($count,$old_ip,$data)=split(" : ",$linea); } if (gethostbyaddr($ip) != $old_ip OR $reloadsperre == FALSE) { $count++ ; } // ===================== if($datei=fopen($counterfile,"a")) { $inf = $count." : ".gethostbyaddr($ip)." : ".date("d/m/Y H:i:s")."\n"; fputs($datei,$inf); fclose($datei); } else { return; } } ?>