Foros del Web » Programando para Internet » PHP »

Recordar la contraseña y enviarla por email

Estas en el tema de Recordar la contraseña y enviarla por email en el foro de PHP en Foros del Web. Hola soy nueve programando en php y pues resulta que me pusieron ha ser lo de la contraseña en una pagina que ya estaba y ...
  #1 (permalink)  
Antiguo 28/04/2008, 09:37
 
Fecha de Ingreso: abril-2008
Mensajes: 9
Antigüedad: 16 años
Puntos: 0
Recordar la contraseña y enviarla por email

Hola soy nueve programando en php y pues resulta que me pusieron ha ser lo de la contraseña en una pagina que ya estaba y pues una no se donde instalar el codigo ademas que al instalarlo me manda muchos errores
<?php require_once('Connections/mgold.php'); ?>
<?php
$midioma_objetos = "0";
if (isset($_GET['idioma'])) {
$midioma_objetos = (get_magic_quotes_gpc()) ? $_GET['idioma'] : addslashes($_GET['idioma']);
}
mysql_select_db($database_mgold, $mgold);
$query_objetos = sprintf("SELECT * FROM objetos_login WHERE objetos_login.idioma='%s'", $midioma_objetos);
$objetos = mysql_query($query_objetos, $mgold) or die(mysql_error());
$row_objetos = mysql_fetch_assoc($objetos);
$totalRows_objetos = mysql_num_rows($objetos);

$mmail_usuario = "0";
if (isset($_POST['email'])) {
$mmail_usuario = (get_magic_quotes_gpc()) ? $_POST['email'] : addslashes($_POST['email']);
}
mysql_select_db($database_mgold, $mgold);
$query_usuario = sprintf("SELECT * FROM uuarios WHERE uuarios.email='%s'", $mmail_usuario);
$usuario = mysql_query($query_usuario, $mgold) or die(mysql_error());
$row_usuario = mysql_fetch_assoc($usuario);
$totalRows_usuario = mysql_num_rows($usuario);
?>
<?php
require_once('Connections/mgold.php');

function Conectarse()
{
if (isset($_POST['email']))
{}

else
{

$mail = $_POST['email'];

{

exit();
}
if (!mysql_select_db($database_mgold, $mgold))
{

exit();
}
return $mgold;
}

?>
<?
$email = @$HTTP_GET_VARS["email"];
$mgold=Conectarse();

$result=mysql_query("select password, usuario from uuarios WHERE email = '$email'",$mail_usuario);

if (!$result) {

exit();
}

//Chekeamos si existe el email
$sql_check_num = mysql_num_rows($result);
if($sql_check_num == 0){

?>

<!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">
<!--
body {
background-color: #A9A381;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
}
a:link {
color: #FFFFFF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: underline;
color: #FFFFFF;
}
a:active {
text-decoration: none;
}
-->
</style>
<link href="Velas_/estilos.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="770" height="561" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th height="561" align="center" valign="top" scope="col"><table width="770" height="71" border="0" align="center">
<tr>
<th scope="col">&nbsp;</th>
</tr>
</table>
<table width="100%" height="200" border="0" cellpadding="0" cellspacing="0">
<tr>
<th align="center" valign="top" scope="col"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="770" height="200">
<param name="movie" value="Velas_/flash/intro.swf" />
<param name="quality" value="high" />
<embed src="Velas_/flash/intro.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="770" height="200" ></embed>
</object></th>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<th height="280" align="center" valign="top" scope="col"><table width="320" height="78" border="0">
<tr>
<th scope="col">&nbsp;</th>
</tr>
</table>

<table width="344" height="154" border="0">
<tr>
<th width="10" height="150" align="center" valign="top" scope="col">&nbsp;</th>
<th width="324" align="center" valign="top" scope="col"><table width="96%" border="0">
<tr>
<th scope="col">
<?
$email = @$HTTP_GET_VARS["email"];
$funtion=Conectarse();

$result=mysql_query("select password, usuario from uuarios WHERE email = '$email'",$mail_usuario);

if (!$result) {

exit();
}

//Chekeamos si existe el email
$sql_check_num = mysql_num_rows($result);
if($sql_check_num == 0){

?>
<?php
exit();
}

// Si va todo bien sacamos todo de la base de datos
while ( $row = mysql_fetch_array($result) ) {
$email = $row["email"];
$password = $row ["password"];
$usuario = $row ["usuario"];
}


// Envía la contraseña

$cuerpo = $row_objetos['tus_datos'] . "\n" . "\n" .
$row_objetos['uuario'] . ": " . $row_usuario['username'] . "\n" . "\n" .
$row_objetos['contrasena'] .": " . $row_usuario['password'] . "\n" . "\n" .
$cabeceras = 'From: ' . " Marival Gold " . "\r\n" .
'Reply-To: '. '[email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($row_usuario['email'], "Marival Gold",$cuerpo,$cabeceras);
?>

&nbsp;</th>
</tr>
</table>

<?php if ($totalRows_usuario > 0) { // Show if recordset not empty ?>
<table width="96%" border="0" class="txt_login">
<tr>
<th height="55" align="center" valign="top" scope="col"><table width="96%" border="0" class="txt_login">
<tr>
<th align="center" valign="top" scope="col"><?php echo $row_objetos['se_envio']; ?></th>
</tr>
</table>
<table width="96%" border="0" class="espacio">
<tr>
<th scope="col">&nbsp;</th>
</tr>
</table> <table width="96%" border="0" class="txt_login">
<tr>
<th align="center" valign="middle" scope="col"><a href="Velas_/login.php?idioma=<?php echo $_GET['idioma']; ?>" target="_self"><?php echo $row_objetos['regresar']; ?></a></th>
</tr>
</table></th>
</tr>
</table>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_usuario == 0) { // Show if recordset empty ?>
<table width="96%" border="0" class="tit_login">
<tr>
<th height="51" align="center" valign="top" scope="col"><table width="96%" border="0" class="txt_login">
<tr>
<th align="center" valign="middle" scope="col"><?php echo $row_objetos['no_existe']; ?></th>
</tr>
</table>
<table width="96%" border="0" class="txt_login">
<tr>
<th align="center" valign="middle" scope="col"><a href="Velas_/login1.php?idioma=<?php echo $_GET['idioma']; ?>" target="_self"><?php echo $row_objetos['regresar']; ?></a></th>
</tr>
</table></th>
</tr>
</table>
<?php } // Show if recordset empty ?></th>
</tr>
</table>
<p>&nbsp;</p></th>
</tr>
</table></th>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($objetos);
mysql_free_result($uuarios);
mysql_free_result($usuario);
?>


Muchas gracias por su ayuda
  #2 (permalink)  
Antiguo 28/04/2008, 09:53
Avatar de Potro  
Fecha de Ingreso: abril-2001
Mensajes: 2.249
Antigüedad: 23 años
Puntos: 39
Re: Recordar la contraseña y enviarla por email

A lo que veo en esta instrucción ya jala los datos usuario y contraseña.

<?
$email = @$HTTP_GET_VARS["email"];
$mgold=Conectarse();

$result=mysql_query("select password, usuario from uuarios WHERE email = '$email'",$mail_usuario);

if (!$result) {

exit();
}



ahi puedes meterle la libreria mail(); y enviarle sus datos...


Saludos.
__________________
Paginación en FLASH,

http://www.forosdelweb.com/f62/pagin...o-aqui-540241/
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 11:37.