<?php session_start();
  require_once("e1bfd762321e409cee4ac0b6e841963c/variables.php");

  $token = $_GET['token'];
  $usu = $_GET['usuario'];

  $conexion = new mysqli('localhost', $_SESSION['usermy'], $_SESSION['pwdmy'], $_SESSION['db']);

  $sql = "SELECT * FROM temporal_usuario WHERE password = '$token'";
  $resultado = $conexion->query($sql);
  
  if( $resultado->num_rows > 0 ){
    $usuario = $resultado->fetch_array(MYSQLI_ASSOC);
    if( md5($usuario['usuario']) == $usu ){
      $encargado = $usuario['cve_enc'];
?>
<!DOCTYPE html>
<html lang="es">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <!-- Meta, title, CSS, favicons, etc. -->
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>.:Recuperar cuenta:.</title>
  <link href="css/bootstrap.min.css" rel="stylesheet">

  <!-- Custom styling plus plugins -->
  <link href="css/custom.css" rel="stylesheet">
  <link href="css/nice.css" rel="stylesheet">
  <script src="js/jquery.min.js"></script>

  <script src="js/jquery-ui.js"></script>
  <script src="js/control.js"></script>
</head>

<body  class="nav-md " style="background:#fff;">
  <div id='loading' style='display: none;'>
    <div class='container-fluid' style='margin:-110px 0 0 -82px; position:absolute; top:50%; left:50%; text-align:center'></div>
    <div><img src='images/Petirrojos.jpg' class='imgPeti' style='width:70px; height:70px;' /></div>
    <div class='spinner'>
      <div class='bounce1'></div>
      <div class='bounce2'></div>
      <div class='bounce3'></div>
    </div>
  </div>
  <div id='todo' style='color: #053e88;'>
    <div class="">
      <div id='tit' class='log_tit'>
        <h1>SISTEMA DE CONTROL DEL PROGRAMA OPERATIVO ANUAL<br>
          <small><span class='visible-lg visible-md'>SISTEMA DE GESTIÓN DE CALIDAD</span>
          <span>DEPARTAMENTO DE PLANEACIÓN PROGRAMACIÓN Y PRESUPUESTACIÓN</span></small></h1>
      </div>
      <div id="wrapper">

        <div class='col-lg-1 col-md-1 visible-lg visible-md'></div>
        <div class='col-lg-5 col-md-5 col-sm-6 visible-lg visible-md visible-sm cen'>
          <img src="images/logotec.png" width='300px;'>
        </div>
        <div class='col-lg-5 col-md-5 col-sm-6 col-xs-12 '>
          <div class='col-lg-1 col-md-1 col-sm-1 visible-lg visible-md visible-sm '></div>
          <div class='row'>
            <div class='visible-xs col-xs-12 cen'><img src="images/logo.png" width='300px;'></div>
            <div id="login" class="animate form">
              <section class="login_content">
                
                <form id='form-password' action="javascript:recuperarPassword();" method="POST">
                  <h1>RESTAURAR CONTRASEÑA</h1>
                  <div>
                    <input type="password" id="password" class="form-control" placeholder="Nueva constraseña" required="" onkeyup="passwordIgual();" onblur="passwordIgual();" />
                  </div>
                  <div>
                    <input type="password" id="confirm_password" class="form-control" placeholder="Confirmar contraseña" required="" onkeyup="passwordIgual();" onblur="passwordIgual();" />
                  </div>
                  <div>
                    <button type='submit' class="btn btn-dark submit" >Recuperar contraseña</button>
                  </div>
                  <input type="hidden" id='encargado' value="<?php echo $encargado ?>" />
                  <input type="hidden" id='token' value="<?php echo $token ?>" />
                </form>
                <div id="respuesta" >&nbsp;</div>
              </section>
            </div>
          </div>
          <div class='col-lg-1 col-md-1 col-sm-1 visible-lg visible-md visible-sm'></div>
        </div>
        <div class='col-lg-1 col-md-1 visible-lg visible-md'></div>
      </div>
    </div>
  </div>

  <!-- bootstrap progress js -->
  <script src="js/progressbar/bootstrap-progressbar.min.js"></script>
  <script src="js/nicescroll/jquery.nicescroll.min.js"></script>

  <script src="js/custom.js"></script>

  <!-- Datatables -->
  <script src="js/datatables/js/jquery.dataTables.js"></script>
  <script src="js/datatables/tools/js/dataTables.tableTools.js"></script>

  <!-- pace -->
  <script src="js/pace/pace.min.js"></script>
  
</body>

</html>

<?php
    
    }
    else{
      header('Location:index.html');
    }
  }
  else{
    header('Location:index.html');
  }
?>
