Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/08/2008, 11:51
[email protected]
 
Fecha de Ingreso: octubre-2005
Mensajes: 405
Antigüedad: 18 años, 6 meses
Puntos: 1
Comparar valor encriptado con uno ingresado en formulario.

La verdad no se si es posible hacer una comparacion de un valor encriptado con un valor ingresado a traves de un formulario.

Código PHP:
<?
//  ---------------------------
require("aut_verifica.inc.php"); // motor de autentificación.
//$password=$_SESSION['usuario_password'];
$password="8e77a69791005723787dfad56d5fb6d4"//password encriptada, formato md5
?>
<html>
<head>
<title>Cambia Password Usuarios</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script lenguaje="Javascript">
function compara()
{
actual=new String()
ingreso=new String()
primera=new String()
segunda=new String()
actual=this.Password.passactual.value
if (actual.length==" ")
{
alert("Debe ingresar actual Password")
return false
}
ingreso=this.Password.password1.value
if (ingreso.length==" ")
{
alert("Debe ingresar nueva Password")
return false
}
ingreso=this.Password.password2.value
if (ingreso.length==" ")
{
alert("Debes repetir ingrese de nueva Password")
return false
}
primera=this.Password.password1.value
segunda=this.Password.password2.value
if (primera != segunda)
{
alert("Ambas Password nuevas deben ser iguales")
return false
}
var=$password.value;
if (var != md5(actual))
{
alert("Password de usuario no coincide con actual ingresada.")
return false
}
return true
}
</script>
</head>
<body>
<form name="Password" method="post" action="verifica_cambio.php" OnSubmit="return compara(this)">
<table width=70% border=1 cellspacing=0 cellpadding=4 align=center id=linea>
<tr >
<td colspan=2 height=30 bgcolor=#0099FF align=center id=linea>.: Cambia Password :.</td>
</tr>
<tr>
<td width=40% align=right id=linea>Reingrese Password actual:</td>
<td width=60% id=linea><input type="password" name="passactual" class="imputbox" maxlength="15"></td>
</tr>
<tr>
<td width=40% align=right id=linea>Ingrese Nueva Password:</td>
<td width=60% id=linea><input type="password" name="password1" class="imputbox" maxlength="15"></td>
</tr>
<tr>
<td width=40% align=right id=linea>(Repita) Nueva Password:</td>
<td width=60% id=linea><input type="password" name="password2" class="imputbox" maxlength="15"></td>
</tr>
<tr>
<td colspan=2 height=40 align=center id=linea>
<input type="submit" name="Submit" value="Cambia Password">
</td>
</tr>
</table>
</form>
</BODY>
</HTML>

Cualquier ayuda se agradece.