mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-11 14:10:06 +01:00
fix: do not count page views for bots
This commit is contained in:
parent
721ed11a45
commit
e78b800c64
1 changed files with 10 additions and 0 deletions
|
@ -174,6 +174,16 @@ function pp_html_escape(string $unescaped) : string {
|
|||
function updatePageViews() : void {
|
||||
global $redis;
|
||||
|
||||
$userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
|
||||
|
||||
// Don't count bots
|
||||
if (empty($userAgent)
|
||||
|| str_contains($userAgent, 'bot')
|
||||
|| str_contains($userAgent, 'spider')
|
||||
|| str_contains($userAgent, 'crawl')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$date = date('jS F Y');
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue