<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>SIEGP</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="./vista/lib/plugins/fontawesome-free/css/all.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Tempusdominus Bbootstrap 4 -->
  <link rel="stylesheet" href="./vista/lib/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
  <!-- iCheck -->
  <link rel="stylesheet" href="./vista/lib/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
  <!-- JQVMap -->
  <link rel="stylesheet" href="./vista/lib/plugins/jqvmap/jqvmap.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="./vista/lib/dist/css/adminlte.min.css">
  <!-- overlayScrollbars -->
  <link rel="stylesheet" href="./vista/lib/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
  <!-- Daterange picker -->
  <link rel="stylesheet" href="./vista/lib/plugins/daterangepicker/daterangepicker.css">
  <!-- summernote -->
  <link rel="stylesheet" href="./vista/lib/plugins/summernote/summernote-bs4.css">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <script src="https://www.google.com/recaptcha/api.js"></script>
  <script type="text/javascript" src="./vista/lib/js/jquery-3.4.1.min.js"></script>

</head>
<body class="hold-transition sidebar-mini layout-fixed text-sm">

  <div class="hold-transition login-page" style="background-image: url(vista/lib/dist/img/img_sgi.jpg); background-repeat: no-repeat;">
	  <div class="login-box">
	      
	    <!-- /.login-logo -->
	    <div class="card">
	      <div class="card-body login-card-body">
	        <!-- <p class="login-box-msg">Iniciar sesión</p> -->
	        <div class="text-center">
	          <a href="#" class="">
	            <img src="./vista/lib/dist/img/logo_sgi.png" style="height: 150px; text-align: center;">
	          </a>
	        </div>
	        <form action="" method="post" id="frm_login">
	          <div class="input-group mb-3">
	            <input type="email" class="form-control" id="username" name="username" placeholder="Usuario" required="">
	            <div class="input-group-append">
	              <div class="input-group-text">
	                <span class="fas fa-envelope"></span>
	              </div>
	            </div>
	          </div>
	          <div class="input-group mb-3">
	            <input type="password" class="form-control" id="password" name="password" placeholder="Contraseña" required="">
	            <div class="input-group-append">
	              <div class="input-group-text">
	                <span class="fas fa-lock"></span>
	              </div>
	            </div>
	          </div>
	          <div class="g-recaptcha container-fluid" data-sitekey="6LenyGkaAAAAAAFkMhB_Ko5_HQG3TmFZ25dFkmqT"></div>
	          <div class="row">
	            <div class="col-sm-12 mt-3">
	              <button type="submit" class="btn btn-success btn-block">Iniciar sesión</button>
	            </div>
	            <!-- /.col -->
	          </div>
	          <br>
	          <div id="msj">
	            
	          </div>
	          <?php 
	            if(isset($_POST['username']) && isset($_POST['password'])){
	              
	              $captcha = $_POST['g-recaptcha-response'];
	              $secret  = '6LenyGkaAAAAAOwKpiKssKsRkxWrIjMnNm6HsDCU';

	              if(!$captcha){
	                echo "<br><div class='alert alert-danger'>Por favor verifica el captcha</div>";
	              }else{

	                require_once "./controlador/administador.controlador.php";

	                $controladorAdministrador = new ControladorAdministrador();
	                
	                echo $controladorAdministrador->ctrConsultaAdministrador();
	                
	              }
	            }
	           ?>
	           
	        </form>
	        <p class="mb-1 mt-2 text-center">
	          <a href="http://alejoposada.info/sie/vista/modulos/restablecerclave.php">¿Olvido su contraseña?</a>
	        </p>
	      </div>
	      <!-- /.login-card-body -->
	    </div>
	  </div>
	</div>
<!-- jQuery -->
<script src="./vista/lib/plugins/jquery/jquery.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="./vista/lib/plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
  $.widget.bridge('uibutton', $.ui.button)
</script>
<!-- Bootstrap 4 -->
<script src="./vista/lib/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- ChartJS -->
<script src="./vista/lib/plugins/chart.js/Chart.min.js"></script>
<!-- Sparkline -->
<script src="./vista/lib/plugins/sparklines/sparkline.js"></script>
<!-- JQVMap -->
<script src="./vista/lib/plugins/jqvmap/jquery.vmap.min.js"></script>
<script src="./vista/lib/plugins/jqvmap/maps/jquery.vmap.usa.js"></script>
<!-- jQuery Knob Chart -->
<script src="./vista/lib/plugins/jquery-knob/jquery.knob.min.js"></script>
<!-- daterangepicker -->
<script src="./vista/lib/plugins/moment/moment.min.js"></script>
<script src="./vista/lib/plugins/daterangepicker/daterangepicker.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="./vista/lib/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Summernote -->
<script src="./vista/lib/plugins/summernote/summernote-bs4.min.js"></script>
<!-- overlayScrollbars -->
<script src="./vista/lib/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="./vista/lib/dist/js/adminlte.js"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<script src="./vista/lib/dist/js/pages/dashboard.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="./vista/lib/dist/js/demo.js"></script>
</body>
</html>


<!-- 
<script type="text/javascript">
  $(document).ready(function(){
    
    $('#frm_login').on('submit', function(e){
      e.preventDefault();
      
      let usuario = $('#username').val();
      let clave   =$('#password').val();
      let captcha =$('#g-recaptcha-response').val();

      if(usuario == ""){

        $('#msj').html('<div class="alert alert-danger">Por favor ingresar un nombre de usuario.</div>');
      
      }else{
          
        if(clave == ""){

          $('#msj').html('<div class="alert alert-danger">Por favor ingresar una contraseña.</div>');

        }else{
          
          if(!captcha){

            $('#msj').html('<div class="alert alert-danger">Por favor verificar el captcha</div>');
          
          }else{
            
            $('#msj').html('');
          
          } 
        
        }  

      }

      // if(usuario != "" && clave !="" && captcha != ""){

      //   $.ajax({
      //     url: './try.php',
      //     type: 'POST',
      //     data: "username="+usuario+"&password="+clave+"&peticion_ajax="+true+"&accion=iniciar_sesion",
      //     success:function(data){

      //       $('#msj').html(data);
          
      //     }

      //   });

      // }

    });

  });
</script> -->
