Foros del Web » Creando para Internet » Herramientas y Software »

recordar y recuperar contraseña

Estas en el tema de recordar y recuperar contraseña en el foro de Herramientas y Software en Foros del Web. hola a todos: he creado un sistema de autentificación con DW y me estoy estrellando con lo de recordar/recuperar contraseñas. He probado insertando código de ...
  #1 (permalink)  
Antiguo 04/04/2006, 02:16
 
Fecha de Ingreso: marzo-2003
Mensajes: 225
Antigüedad: 21 años, 2 meses
Puntos: 0
recordar y recuperar contraseña

hola a todos:

he creado un sistema de autentificación con DW y me estoy estrellando con lo de recordar/recuperar contraseñas. He probado insertando código de scripts en el de DW pero no va, cuestión de cookies, supongo, y de que no tengo idea de php.

¿Cómo puedo incluir esas opciones en el login?.
Gracias por adelantado
  #2 (permalink)  
Antiguo 07/04/2006, 08:35
Avatar de Mickel  
Fecha de Ingreso: mayo-2002
Ubicación: Lima, Peru
Mensajes: 4.619
Antigüedad: 22 años
Puntos: 7
como estas haciendo la validacion de usuarios? si escribes por aqui la estrucutra de tus tablas de usuarios te podria pasar unas cuantas lineas de php para que hagas eso...
__________________
No tengo firma ahora... :(
  #3 (permalink)  
Antiguo 07/04/2006, 11:23
 
Fecha de Ingreso: marzo-2003
Mensajes: 225
Antigüedad: 21 años, 2 meses
Puntos: 0
contraseñas

Hola:

la estructura de la tabla es

CREATE TABLE `php_users` (
`user_id` mediumint(8) NOT NULL default '0',
`username` varchar(25) NOT NULL default '',
`user_password` varchar(32) NOT NULL default '',
PRIMARY KEY (`user_id`)
) TYPE=MyISAM;

aunque quiero añadirle un campo para la dirección de correo y probablemente otros 2 para nombre y apellidos,
hasta ahora tengo unos 300 usuarios con contraseñas encriptadas con md5;

el código del login es:

<?php require_once('../Connections/zona.php'); ?>
<?php
// *** Redirect if username exists
$FF_flag="MM_insert";
if (isset($$FF_flag)) {
$FF_dupKeyRedirect="logz.php";
$FF_dupKeyUsernameValue = $HTTP_POST_VARS["textfield"];
$FF_dupKeySQL = "SELECT username FROM phpbb_users WHERE username='" . $FF_dupKeyUsernameValue . "'";
mysql_select_db($database_zona, $zona);
$FF_rsKey=mysql_query($FF_dupKeySQL, $zona) or die(mysql_error());
if(mysql_num_rows($FF_rsKey) > 0) {
// the username was found - can not add the requested username
$FF_qsChar = "?";
if (strpos($FF_dupKeyRedirect, "?")) $FF_qsChar = "&";
$FF_dupKeyRedirect = $FF_dupKeyRedirect . $FF_qsChar . "requsername=" . $FF_dupKeyUsernameValue;
header ("Location: $FF_dupKeyRedirect");
exit;
}
mysql_free_result($FF_rsKey);
}

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO phpbb_users (username, user_password) VALUES (%s, %s)",
GetSQLValueString($_POST['textfield'], "text"),
GetSQLValueString($_POST['textfield2'], "text"));

mysql_select_db($database_zona, $zona);
$Result1 = mysql_query($insertSQL, $zona) or die(mysql_error());

$insertGoTo = "log2.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?><?php require_once('../Connections/zona.php');

// *** Start the session
session_start();
// *** Validate request to log in to this site.
$FF_LoginAction = $PHP_SELF;
if (isset($QUERY_STRING) && $QUERY_STRING!="") $FF_LoginAction .= "?".$QUERY_STRING;
if (isset($textfield)) {
$FF_valUsername=$textfield;
$FF_fldUserAuthorization="";
$FF_redirectLoginSuccess="../socios/soclis.php";
$FF_redirectLoginFailed="log2.php";
$FF_rsUser_Source="SELECT username, user_password ";
if ($FF_fldUserAuthorization != "") $FF_rsUser_Source .= "," . $FF_fldUserAuthorization;
$FF_rsUser_Source .= " FROM phpbb_users WHERE username='" . $FF_valUsername . "' AND user_password='" . md5($textfield2) . "'";
mysql_select_db($database_zona, $zona);
$FF_rsUser=mysql_query($FF_rsUser_Source, $zona) or die(mysql_error());
$row_FF_rsUser = mysql_fetch_assoc($FF_rsUser);
if(mysql_num_rows($FF_rsUser) > 0) {
// username and password match - this is a valid user
$MM_Username=$FF_valUsername;
session_register("MM_Username");
if ($FF_fldUserAuthorization != "") {
$MM_UserAuthorization=$row_FF_rsUser[$FF_fldUserAuthorization];
} else {
$MM_UserAuthorization="";
}
session_register("MM_UserAuthorization");
if (isset($accessdenied) && false) {
$FF_redirectLoginSuccess = $accessdenied;
}
mysql_free_result($FF_rsUser);
session_register("FF_login_failed");
$FF_login_failed = false;
header ("Location: $FF_redirectLoginSuccess");
exit;
}
mysql_free_result($FF_rsUser);
session_register("FF_login_failed");
$FF_login_failed = true;
header ("Location: $FF_redirectLoginFailed");
exit;
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<style type="text/css">
<!--
.Estilo1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9;
}
.Estilo2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #FF0000; }
.Estilo3 {color: #666666}
.Estilo4 {color: #333333}
.Estilo5 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; }
.Estilo7 {font-size: 16}
.Estilo8 {
font-size: 14px;
color: #666666;
}
.Estilo9 {font-size: 12px}
.Estilo10 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; color: #666666; }
.Estilo11 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #666666; }
-->
</style>
</head>

<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="250" border="0" align="center">
<tr>
<td width="244" class="Estilo2"><div align="center"><span class="Estilo7">semer.es<span class="Estilo3"> - <span class="Estilo4">acceso socios</span> </span></span></div></td>
</tr>
<tr>
<td class="Estilo5"><div align="center" class="Estilo8">
<div align="center">introduce tus claves </div>
</div></td>
</tr>
<tr>
<td class="Estilo5"><form action="<?php echo $editFormAction; ?>" method="POST" name="form1" class="Estilo1" id="form1">
<pre><label><span class="Estilo3">usuario <input name="textfield" type="text" size="12" /> </span></label>
<span class="Estilo3"><label>contraseña</label></span><label> <input name="textfield2" type="password" size="12" /></label> <input type="submit" name="Submit" value="entrar" />
</pre>
<input type="hidden" name="MM_insert" value="form1">
</form></td>
</tr>
</table>
</body>
</html>


gracias por adelantado
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:46.