<?php
$root = $_SERVER['DOCUMENT_ROOT'];
$headerScriptRoot = dirname(__FILE__, 2);
if ($root == $headerScriptRoot) {
	$baseHref = '/';
} else {
	$baseHref = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], "/", 1) + 1);
}
$baseHref = str_replace("\\", "/", $baseHref);
$lpType = "";
$availableLpTypes = array("1step", "2steps");
if (!empty($_GET["intgrtn_lpType"])) {
	if (in_array($_GET["intgrtn_lpType"], $availableLpTypes)) {
		$lpType = $_GET["intgrtn_lpType"];
		setcookie("intgrtn_lpType", $lpType, time() + (86400 * 30)); // 86400 = 1 day

	}
}
function getRegistrationForm($lpType)
{
	switch ($lpType) {
		case "1step":
			$formType = "one-step-signup.php";
			break;
		case "2step":
			$formType = "two-steps-signup.php";
			break;
		default:
			$formType = "two-steps-signup.php";
	}
	return __DIR__ . "/../common/" . $formType;
}
setcookie("intgrtn_language", $requestedPageTranslationIso, time() + (86400 * 30), $baseHref);
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="pl">

<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/>
    <title>Bitcoin Bank Breaker</title>
    <base href="<?= $baseHref; ?>">
    <link rel="icon" href="img/favicon.png" type="image/x-icon"/>
    <link rel="stylesheet" href="css/main.bundle.min.css"/>

    <link rel="stylesheet" href="css/main.minae15.css"/>
    <link rel="stylesheet" href="css/custom-alt-2.css"/>

    <link rel="stylesheet" href="js/videojs/video-js.css">
    <script type="text/javascript" src="js/videojs/video.js"></script>
    <link rel="stylesheet" href="css/intgrtn.css">
