From 9478c7cecd995f3cc47e0bae4768d5c558a458ff Mon Sep 17 00:00:00 2001 From: Christopher Teutsch Date: Sun, 27 Dec 2020 19:08:21 +0100 Subject: [PATCH] Visitor counting with bot exclusion --- index.php | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 0bca59d..6a95112 100644 --- a/index.php +++ b/index.php @@ -63,8 +63,8 @@ $ical->initUrl($ICAL_URL, $acceptLanguage = 'de'); $events = $ical->eventsFromInterval('2 week'); $first_event = $events[0]; $events = array_slice($events, 1); -$locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']); -if ($locale !== null){ +if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ + $locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']); setlocale(LC_TIME, $locale); } } @@ -178,6 +178,27 @@ $v = file_get_contents($VISITORS_FILE);