1 | <?php |
---|
2 | /* Functions */ |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | |
---|
11 | /* |
---|
12 | returns (mixed): (string) 'bot agent name' || (bool) false |
---|
13 | @param (string) HTTP_USER_AGENT |
---|
14 | */ |
---|
15 | function is_a_bot($agent = '') |
---|
16 | { |
---|
17 | global $conf; |
---|
18 | if ($agent == '') $agent = $_SERVER['HTTP_USER_AGENT']; |
---|
19 | $botlist = array('Teoma', 'alexa', 'froogle', 'Gigabot', 'inktomi', |
---|
20 | 'looksmart', 'URL_Spider_SQL', 'Firefly', 'NationalDirectory', |
---|
21 | 'Ask Jeeves', 'TECNOSEEK', 'InfoSeek', 'WebFindBot', 'girafabot', |
---|
22 | 'crawler', 'www.galaxy.com', 'Googlebot', 'Scooter', 'Slurp', |
---|
23 | 'msnbot', 'appie', 'FAST', 'WebBug', 'Spade', 'ZyBorg', 'rabaz', |
---|
24 | 'Baiduspider', 'Feedfetcher-Google', 'TechnoratiSnoop', 'Rankivabot', |
---|
25 | 'Mediapartners-Google', 'Sogou web spider', 'WebAlta Crawler'); |
---|
26 | if (isset($conf['search_agents'])) |
---|
27 | $botlist = array_merge( $botlist, array_diff( $conf['search_agents'], $botlist ) ); |
---|
28 | foreach($botlist as $bot) { |
---|
29 | if (stripos($agent, $bot)!==false) return $bot; |
---|
30 | } |
---|
31 | return false; |
---|
32 | } |
---|
33 | ?> |
---|