<?php require('casa/setup.casa.php');
//if($_SERVER['HTTPS'] != 'on') echo '<script>self.location="'.PATH_HOME.'";</script>';

$titulo=' :: Iniciar Sesión';
include('inc_head.php');
?>
</head>
<body class="bg-dark">
	<div class="wrapper">		
			<div class="content">				
				<div class="page-inner">
				<!-- -->	<br><br>
					<div class="row">
						<div class="col-md-4"></div>						
						<div class="col-md-4">
							<div class="card bg-blue">
								<form>								
								<div class="card-body">								
									<div class="row">																				
										<div class="col-md-12 col-lg-12 text-center">				
											<img src="<?php echo PATH_HOME.'fondo.jpg';?>" class='avatar-img rounded' width='100%'>											
										</div>	
										<div class="col-md-12 col-lg-12">				
											<div class="form-group">
												<div class="input-group mb-3">													
													<div class="input-group-prepend">
														<span class="input-group-text"><b>Usuario:</b></span>
													</div>												
													<input id='txtUser' type="text" class="form-control">
												</div>
												<div class="input-group mb-3">
													<div class="input-group-prepend">
														<span class="input-group-text"><b>Contraseña:</b></span>
													</div>
													<input id='txtPass' type="password" class="form-control">																			
													<span onclick='VerPW()' class="fas fa-eye-slash" style='margin:15px 0 0 7px;'></span>
												</div>												
											</div>																					
										</div>																			
									</div>	
									<div id='res'></div>
									<div class=" text-center">
										<button type='submit' class="btn btn-default">INICIAR SESIÓN</button>									
									</div>
														
								</div>
								
								</form>
							</div>
						</div>
						<div class="col-md-4"></div>
					</div>
				<!-- -->									
				</div>
			</div>	
			<?php include('inc_pie.php');?>
	</div>	
</body>
</html>
<script>
$('form').on('submit', function(event) {
  event.preventDefault();

  $.post('<?php echo PATH_HOME.'indlogin/'.md5(uniqid()); ?>',{
    'uss': $('#txtUser').val(),
    'pss': $('#txtPass').val(),
    'coder': '<?php echo sha1(uniqid()); ?>'
  },function(data){
    $('#res').html(data);
  });
  
});

let sw=true;
function VerPW(){
	if(sw){
		$("#txtPass").attr("type", "text");
		sw=false;
	}else{
		$("#txtPass").attr("type", "password");
		sw=true;
	}		
}
</script>