From be0e7c8498c3f065c9dbdc1300b84d41b2aa6739 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 25 Jul 2019 14:29:54 +0200 Subject: lib/mysql.php: abort_iff_webspider() new - for now only logging the user agent --- lib/mysql.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/mysql.php b/lib/mysql.php index ca683d8..7564a3d 100644 --- a/lib/mysql.php +++ b/lib/mysql.php @@ -98,3 +98,15 @@ function arch_filter_query($table) { $arch_filter .= ")"; return $arch_filter; } + +function abort_iff_webspider() { + if (($fp = fopen(BASE . '/user-agent-log', 'a')) !== false) { + flock($fp, LOCK_EX); + fwrite($fp, + date('Y-m-d H:i:s') . " " . + $_SERVER['HTTP_USER_AGENT'] . "\n" + ); + flock($fp, LOCK_UN); + fclose($fp); + } +} -- cgit v1.2.3-70-g09d2