From 40b5f862c2efeb4ef0d71af125e515f5532384ca Mon Sep 17 00:00:00 2001 From: Zhai Yiming Date: Tue, 11 Jul 2017 11:05:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8D=E8=83=BD=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E8=AF=86=E5=88=AB=E6=9C=AA=E7=9F=A5=E7=88=AC=E8=99=AB?= =?UTF-8?q?=E5=85=A8=E7=A7=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Access_Parser.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Access_Parser.php b/Access_Parser.php index 9cb4c03..f9845f7 100644 --- a/Access_Parser.php +++ b/Access_Parser.php @@ -135,16 +135,17 @@ class Access_Parser $ua = $this->filter($ua); if (!empty($ua)) { foreach ($this->bots as $val) { + if (($val == 'Bot' || $val == 'Spider') + && (preg_match('#([a-zA-Z0-9]+(bot|spider))[ /]*([0-9.]*)#i', $ua, $matches))) { + $this->currentBot = $matches[1] . $matches[2]; + return true; + } $str = $this->filter($val); if (strpos($ua, $str) !== false) { $this->currentBot = $str; return true; } } - if (preg_match('#([a-zA-Z0-9]+(bot|spider))[ /]*([0-9.]*)#i', $ua, $matches)) { - $this->currentBot = $matches[1] . $matches[2]; - return true; - } } else { return false; }