prepare('SELECT id FROM projects WHERE id = ? AND is_active = 1'); $st->execute([$pid]); if ($st->fetch()) { try { $db->prepare('INSERT INTO site_visits (project_id, path, referrer, ua_hash, ip_hash) VALUES (?, ?, ?, ?, ?)') ->execute([$pid, $path, $ref ?: null, $uaHash, $ipHash]); } catch (Exception $e) { /* don't fail the pixel on logging error */ } } // 1x1 transparent PNG, cache-busted by request header('Content-Type: image/png'); header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); header('Pragma: no-cache'); header('Access-Control-Allow-Origin: *'); echo base64_decode( 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkAAIAAAYAAjCB0C8AAAAASUVORK5CYII=' );