$filename = __DIR__ . "/increm.dat"; if (File_Exists($filename)): $fp = @FOpen($filename, "r+"); if (!$fp) { return; } $hits = FGetS($fp, 10) + 1; Rewind($fp); else: $fp = @FOpen($filename, "w"); if (!$fp) { return; } $hits = 1;endif; FPutS($fp, $hits); FClose($fp); /* zaciatok ulozenia na disk========================================================== */ /*inkrementacia*/ /* zjisti IP adresu pozadavku */ $ip = getenv("REMOTE_ADDR"); /* prevede IP adresu na domenovou adresu pocitace */ $host = gethostbyaddr($ip); /* promenna $refer obsahuje adresu pocitace */ $refer = getenv("HTTP_REFERER"); if ($refer == "") { $refer = "Prime volani"; } /* $browser obsahuje nazev prohlizece */ if (eregi("msie", $HTTP_USER_AGENT)) { $browser = "MSIE"; } else { if (eregi("opera", $HTTP_USER_AGENT)) { $browser = "Opera"; } else { if (eregi("mozilla", $HTTP_USER_AGENT)) { $browser = "Netscape-FireFox"; } else { if (eregi("kongueror", $HTTP_USER_AGENT)) { $browser = "Kongueror"; } else { if (eregi("lynx", $HTTP_USER_AGENT)) { $browser = "Lynx"; } else { if (eregi("links", $HTTP_USER_AGENT)) { $browser = "Links"; } else { $browser = "Ostatne"; } } } } } } /* $system obsahuje nazev OS*/ if (eregi("win", $HTTP_USER_AGENT)) { $system = "Windows"; } else { if (eregi("linux", $HTTP_USER_AGENT)) { $system = "Linux"; } else { if (eregi("mac", $HTTP_USER_AGENT)) { $system = "Macintosh"; } else { if (eregi("sunos", $HTTP_USER_AGENT)) { $system = "SunOS"; } else { if (eregi("freebsd", $HTTP_USER_AGENT)) { $system = "FreeBSD"; } else { if (eregi("irix", $HTTP_USER_AGENT)) { $system = "IRIX"; } else { $system = "Ostatne"; } } } } } } /* ulozenie na disk okrem IP domaa v praci */ if ($ip == '193.58.192.74') { } else { if ($ip == '88.212.34.222') { } else { $fp = FOpen(__DIR__ . "/ktobol.csv", "a"); FPutS($fp, "$hits ;"); FPutS($fp, "" . Date("d.m.Y") . ";"); FPutS($fp, "" . Date("H:i:s") . ";"); FPutS($fp, "$ip;"); FPutS($fp, "$host;"); FPutS($fp, "$refer;"); FPutS($fp, "$browser;"); FPutS($fp, "$system \n"); FClose($fp); } } /* koniec ulozenia na disk========================================================== */