<?php
require_once __DIR__ . "/../Febe.php";
$febe = new Febe;
$febe->setCurrentSubFolderLanguageCookie();

$lpType = '';
$availableLpTypes = array("nopwd");
if (!empty($_GET["intgrtn_lpType"])) {
    if (in_array($_GET["intgrtn_lpType"], $availableLpTypes)) {
        $lpType = $_GET["intgrtn_lpType"];
    }
}

$formType = "";
$formVersion = !empty($_GET["intgrtn_formType"]) ? $_GET["intgrtn_formType"] : "";
function getRegistrationForm($formVersion)
{
    switch ($formVersion) {
        case "1step":
            $formType = "one-step-signup.php";
            break;
        case "2steps":
            $formType = "two-steps-signup.php";
            break;
        case "3steps":
            $formType = "three-steps-signup.php";
            break;
        default:
            $formType = "one-step-signup.php";
    }
    return __DIR__ . "/../common/" . $formType;
}
function getTrackingUrl(): string
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://server.4markets.net/api/v2/offers/tracking-domain");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Referer: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
    ]);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    if ($httpCode != 200) {
        return "";
    }
    if (empty($response)) {
        return "";
    }

    $responseTrackingDomainJson = json_decode($response);

    if (empty($responseTrackingDomainJson)) {
        return "";
    }

    return $responseTrackingDomainJson->details->endpoint;
}

$trackingUrl = getTrackingUrl();
?>
<!DOCTYPE html>
<html lang="en">
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<!-- /Added by HTTrack -->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>YuanPay Group</title>
    <meta name="description" content="">
    <base href="<?= $febe->getHref(); ?>">

    <link rel="shortcut icon" href="assets/favicon.ico">
    <link rel="stylesheet" href="css/header.css">
    <link rel="stylesheet" href="css/style_v4.css">
    <link rel="stylesheet" href="css/intgrtn.css?v=2">
    <link rel="stylesheet" href="js/videojs/video-js.css">
    <style type="text/css">/* Chart.js */
        @-webkit-keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        @keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        .chartjs-render-monitor {
            -webkit-animation: chartjs-render-animation 0.001s;
            animation: chartjs-render-animation 0.001s;
        }
    </style>
    <script type="text/javascript">
        function cDate(mode = "full") {
            // Array of day names
            var dayNames = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
            // Array of month Names
            var monthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

            var now = new Date();

            if (mode == "full")
                document.write(dayNames[now.getDay()] + ", " + monthNames[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear());
            else if (mode == "short")
                document.write(monthNames[now.getMonth()] + " " + now.getDate());
        }

        function cYDate() {
            // Array of day names
            var dayNames = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
            // Array of month Names
            var monthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

            var c_date = new Date();
            c_date.setDate(c_date.getDate() - 1);
            document.write(monthNames[c_date.getMonth()] + " " + c_date.getDate() + ", " + c_date.getFullYear());
        }

        function cMDate() {
            // Array of month Names
            var monthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

            var c_date = new Date();
            document.write(monthNames[c_date.getMonth()]);
        }

        function cMDateES() {
            // Array of month Names
            var monthNames = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");

            var c_date = new Date();
            document.write(monthNames[c_date.getMonth()]);
        }


        function c3agoDate() {
            // Array of day names
            var dayNames = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
            // Array of month Names
            var monthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

            var c_date = new Date();
            c_date.setDate(c_date.getDate() - 3.2);
            document.write(monthNames[c_date.getMonth()] + " " + c_date.getDate());
        }
    </script>
