Add bot user agent detection (close #32)

master
Skylar Ittner 6 years ago
parent f1e406bace
commit 7e4783ded3

File diff suppressed because it is too large Load Diff

@ -21,6 +21,13 @@ if (!$database->has("settings", ["AND" => ["siteid" => getsiteid(), "key" => "an
throw new Exception("Do-Not-Track header detected, skipping analytics");
}
$bots = json_decode(file_get_contents(__DIR__ . "/bots.json"), true);
foreach ($bots as $bot) {
if (preg_match('/' . $bot['pattern'] . '/', $_SERVER['HTTP_USER_AGENT'])) {
throw new Exception("Bot/crawler detected, skipping analytics");
}
}
$time = date("Y-m-d H:i:s");
/**

Loading…
Cancel
Save