$ip = getenv("REMOTE_ADDR"); $fil = "logg.txt"; $f = file($fil); $antal = count($f); $yest = time() - 1800; $o = "0"; $xidag = "f"; $idag = time(); $idag2 = date("Y F d, H:i"); while ($antal > $o) { $streg = explode(" ", $f[$o]); if ($ip == $streg[0]) { $x = "t"; if ($streg[1] > $yest) { $xidag = "t"; } } $o++; } if ($xidag == "f") { $logg = fopen("$fil", "a"); fputs ($logg, "$ip $idag, $idag2\n"); fclose ($logg); } $f = file($fil); $antal = count($f); if ($x == "t") { print "Besøkende totalt: $antal"; } else { print "Besøkende totalt: $antal"; } ?>