| Server IP : 104.21.21.239 / Your IP : 216.73.217.39 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/banners/public_html/bway/pixel/ |
Upload File : |
<?php
/**
* Bot Filter — Unified bot/spider detection for all pixel endpoints.
*
* Consolidates the various bot keyword lists from:
* - pixel-article.cfm: EZAutoInsert, bot, spider
* - sitepixel.cfm: bot, spider, crawler, slurp, mediapartners, baidu, yandex
* - pixel-people.cfm: bot, spider, slurp, MSIE 6, addthis, crawler, EZAutoInsert
*/
class BotFilter
{
private const BOT_KEYWORDS = [
'bot',
'spider',
'crawler',
'slurp',
'mediapartners',
'baidu',
'yandex',
'ezautoinsert',
'addthis',
];
/**
* Returns true if this request should be tracked (i.e. NOT a bot).
*/
public static function shouldTrack(?string $userAgent = null): bool
{
$ua = $userAgent ?? ($_SERVER['HTTP_USER_AGENT'] ?? '');
if ($ua === '') {
return false;
}
$uaLower = strtolower($ua);
foreach (self::BOT_KEYWORDS as $keyword) {
if (str_contains($uaLower, $keyword)) {
return false;
}
}
return true;
}
}