Jump to content

Recommended Posts

hi i have a problem with the code to remind the user's password if their forget, the user enter their email address and get them on the mailbox, everything works, but in a place where it should be the password is blank.

Help please here's the code:

 

 

<?

 

include 'db.php';

// Conver to simple variables

 

 

switch($_POST['recover']){

default:

include 'lost_pw.html';

break;

 

case "recover":

recover_pw($_POST['email_address']);

break;

}

function recover_pw($email_address){

if(!$email_address){

echo "You forgot to enter your Email address !!<br />";

include 'lost_pw.html';

exit();

}

// quick check to see if record exists

$sql_check = mysql_query("SELECT * FROM users WHERE email_address='$email_address'");

$sql_check_num = mysql_num_rows($sql_check);

if($sql_check_num == 0){

echo "No records found matching your email address<br />";

include 'lost_pw.html';

exit();

}

// Everything looks ok, generate password, update it and send it!

 

 

 

$db_password = md5 ($password);

 

$to = "email";

$sql = mysql_query("UPDATE users SET password='$password_md5' WHERE email_address='$email_address'");

$headers = "From: mymail@02.com";

$subject = "Your Password at MyWebsite!";

$message = "Hi $username  your username and password is,

 

Username:$username

Password:$password

 

http://www.something.com/login_form.html

 

Thanks!

The Webmaster

 

This is an automated response, please do not reply!";

 

mail($email_address, $subject, $message, "From: M@m.com>\nX-Mailer: PHP/" . phpversion());

include 'password.html';

}

?>

Link to comment
https://forums.phpfreaks.com/topic/226670-trouble-with-code-to-remind-password/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.