Finalrecuperacion.php 3.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
<?php session_start();
if(isset($_SESSION["ErrS"])){
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="default.css" media="screen" />
<title>....::: Recuperacion de Contrasea</title>
<style type="text/css">
<!--
#Layer2 {	position:absolute;
	left:305px;
	top:104px;
	width:419px;
	height:21px;
	z-index:2;
}
#Layer1 {
	position:absolute;
	left:178px;
	top:148px;
	width:680px;
	height:143px;
	z-index:3;
}
.style1 {color: #FF0000}
.style2 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
<script language="javascript">
function valida(){
if(form.contra.value==""){
alert('Debe introducir una contrasea valida');
form.contra.focus();
return(false);
}//contra

if(form.contra2.value==""){
alert('Confirme su contrasea');
form.contra2.focus();
return(false);
}//contra2

if(form.contra.value != form.contra2.value){
alert('La confirmacin de la contrasea no es igual\n o ha cometido un error de escritura\n Vuelva a introducir su nueva contrasea');
form.contra.focus();
return(false);
}
}//valida
</script>
</head>
<body>
<?php
include 'conexion.php';
$nick=$_REQUEST["nick"];
$respuesta=$_REQUEST["respuesta"];
$respuesta=strtoupper ($respuesta);


$querySelect="select farm_usuarios.*,usr_respquestion.*,usr_secretquestion.* from farm_usuarios
inner join usr_respquestion
on usr_respquestion.IdPersonal=farm_usuarios.IdPersonal
inner join usr_secretquestion
on usr_secretquestion.IdSecretQuestion=usr_respquestion.IdSecretQuestion
where farm_usuarios.nick='$nick' and usr_respquestion.Respuesta='$respuesta'";
conectar();
$resp=mysql_query($querySelect);
desconectar();


if($row=mysql_fetch_array($resp)){
$id=$row["IdPersonal"];
$_SESSION["ID"]=$id
?>

<div align="center" class="style2" id="Layer2">RECUPERACI&Oacute;N DE CONTRASE&Ntilde;AS </div>
<div id="Layer1">
<form action="recuperacionTerminada.php" method="post" name="form" onSubmit="return valida(this)">
  <table width="669" border="0">
    <tr class="MYTABLE">
      <td colspan="2">&nbsp;</td>
      </tr>
    <tr>
      <td width="236" class="FONDO">&nbsp;Usuario (Nick): </td>
      <td class="FONDO">&nbsp;<input type="text" name="nick" size="50" readonly="true" value="<?php echo $nick; ?>"></td>
      </tr>
    <tr>
      <td class="FONDO">&nbsp;Nueva Contrase&ntilde;a (Password) : </td>
      <td class="FONDO">&nbsp;<input type="password" name="contra" maxlength="15">
        <span class="style1">*</span></td>
      </tr>
    <tr>
      <td class="FONDO">&nbsp;Confirmaci&oacute;n de Contrase&ntilde;a:</td>
      <td class="FONDO">&nbsp;<input type="password" name="contra2" maxlength="15">
        <span class="style1"> *</span></td>
      </tr>
    <tr>
      <td colspan="2" align="right" class="FONDO"><input type="submit" name="enviar" value="Re-Establecer Contrasea" title="Re-Establecer Contrasea"></td>
      </tr>
    <tr class="MYTABLE">
      <td colspan="2" align="center">Paso 3 de 3 </td>
      </tr>
  </table>
  </form>
</div>
</body>
</html>
<?php
}//fin IF fetch_array
else{?>
<script language="javascript">
window.location='recuperacion.php?Err=1&nick=<?php echo"$nick"; ?>&ErrS=1';
</script>
<?php
}


}//fin de IF isset principal
else{
?>
<script language="javascript">
window.location='index.php';
</script>
<?php
}
?>