HEX
Server: Apache/2.4.57 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2
System: Linux vmi267337.contaboserver.net 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64
User: ohirex (1008)
PHP: 8.2.8
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec
Upload Files
File: /home/ohirex/web/ohirex.com/public_html/join/url.php
<?php
require_once __DIR__.'/settings.php';
require_once __DIR__.'/cookies.php';
require_once __DIR__.'/pixels.php';

//заменяем все макросы на реальные значения из куки
function replace_all_macros($url)
{
    global $fbpixel_subname;
    $px = get_fbpixel();
    $landing = get_cookie('landing');
    $prelanding = get_cookie('prelanding');
    $subid = get_subid();

    $tmp_url = str_replace('{px}', $px, $url);
    $tmp_url = str_replace('{landing}', $landing, $tmp_url);
    $tmp_url = str_replace('{prelanding}', $prelanding, $tmp_url);
    $tmp_url = str_replace('{subid}', $subid, $tmp_url);
    $tmp_url = str_replace('{domain}', $_SERVER['SERVER_NAME'], $tmp_url);
    return $tmp_url;
}

function add_querystring($url)
{
    $delimiter= (strpos($url, '?')===false?"?":"&");
    $querystr = $_SERVER['QUERY_STRING'];
    if (!empty($querystr)) {
        $url = $url.$delimiter.$querystr;
    }
    return $url;
}

function add_subs_to_link($url)
{
    global $sub_ids;
    $preset=['subid','prelanding','landing'];
    foreach ($sub_ids as $sub) {
    	$key = $sub["name"];
        $value = $sub["rewrite"];
        $delimiter= (strpos($url, '?')===false?"?":"&");
        if (in_array($key,$preset)){
            $cookie = get_cookie($key);
            if ($cookie!=='')
                $url.= $delimiter.$value.'='.$cookie;
        } elseif (!empty($_GET[$key])) {
            $url.= $delimiter.$value.'='.$_GET[$key];
        }
    }
    return $url;
}


function replace_subs_in_link($url)
{
    global $sub_ids;
    $preset = ['subid', 'prelanding', 'landing'];

    // Parse the URL to get its components
    $url_components = parse_url($url);

    // Parse the query string into an associative array
    parse_str($url_components['query'] ?? '', $query_array);

    // Iterate over the $sub_ids and replace the keys
    foreach ($sub_ids as $sub) {
        $key = $sub["name"];
        $value = $sub["rewrite"];

        if (array_key_exists($key, $query_array)) {
            // Replace the key in the query array
            $query_array[$value] = $query_array[$key];
            unset($query_array[$key]);
        } elseif (in_array($key, $preset)) {
            // Set from cookie if not in query string
            $cookie = get_cookie($key);
            if ($cookie!=='')
                $query_array[$value] = $cookie;
        }
    }

    // Build the new query string
    $new_query = http_build_query($query_array);

    // Rebuild the URL
    $new_url = $url_components['scheme'] . '://' . $url_components['host'];
    if (isset($url_components['path'])) {
        $new_url .= $url_components['path'];
    }
    
    if (isset($url_components['fragment'])) {
        $new_url .= '#'.$url_components['fragment'];
    }

    if ($new_query) {
        $new_url .= '?' . $new_query;
    }

    return $new_url;
}
?>