<?php
session_start();

   include_once("../scripts/connect.php");
   $conexion=conecta_default();

   include("../scripts/session.php");
   //Validar Session

   $sesion=new Sesion("","","");/*Se crea un objeto nuevo con el privilegio necesario para la pag. actual*/
    if(!$sesion->isValida("1")){ /*Sesion invalida*/
	 header("Location: ../login.php?err=NoSesion");
    }/*no hay sesion*/

    else{
       $dato=explode("|",$_SESSION['usuario']);
       $sesion->setDatos($dato[0],$dato[1],$dato[2]);
    }

    //fin validar session

    $id_dist = $sesion->id;
	
		
   $busqusr = "SELECT passwd FROM usuarios_sist WHERE idusuarios_sist = '$id_dist'";
   $cons = mysqli_query($conexion, $busqusr) or die ('Err0: '.mysqli_error($conexion));
   $usr = mysqli_fetch_object($cons);
   $pass = $usr->passwd; 
?>

<html>
<head>
<title></title>

<script language="JavaScript" src="../scripts/md5.js"></script> 

<script language="JavaScript" src="../scripts/etc.js" type="text/javascript"></script> 



<script language='JavaScript1.2' type='text/javascript'>

 function CadenaVaciaBlancos(cadena) {
   var salida='';
   for (var i=0;i<cadena.length;i++) {
	if (cadena.substring(i,i+1)!=' ')
		salida=salida+cadena.substring(i,i+1);
	}
   if (salida.length==0){
	return true;
	}
   else {
	return false;
	}
   }

function valida(e, x){
    if(CadenaVaciaBlancos(e.psw.value))
    {
    alert('Por favor escribe la contrase�a secreta')
    e.psw.select()
    return false;
    }
	
	
	var elem=getObjeto("psw");  
    var valor=hex_md5(elem.value);
    if (valor != x)
    {
    	alert('La contrase�a es incorrecta, favor de verificar, gracias')
    	elem.select()
    	return false
    }
   }
    

</script>

</head>
<body bgcolor="#ffffff" onload="document.conf.psw.select();">

<br />
<form name="conf" action="repartirregalias.php" method="post">
<center> 
<label style="color:#5C3C12; font-size:28px; font-weight:bold">Confirmar Contrase&ntilde;a </label>
 	
<table border="0" width="500" height="400" align="center" style="background: url(logotransp2.gif)">
<tr height='50'><td></tr>
<tr height="80"><td>Favor de volver a escribir la contrase�a secreta para continuar:</tr>
<tr height="50">
<td align="center"><label style="color:#5C3C12">Contrase&ntilde;a:</label>&nbsp;<input type="password" size="14" maxlength="13" name="psw" id="psw" value="" style="font-family: Times New Roman"></tr>
<tr height="100"><td align="center"><input type="submit" value="Confirmar" onclick="return valida(this.form, '4bd42875734e39dbc278831684949116')"></tr>
<tr><td></tr>
</table>

</center>
</form>
<br />
</body>

</html>

