Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Forgotten password help

Guest
Sep 10, 2007 Sep 10, 2007
I am building my site using Dreamweaver & PHP. I found a forgotten password script on PHPeasystep but have found adjusting the script to work on my site rather difficult. Here is the script

<?php require_once('Connections/member.php');

// value sent from form
$email_to=$_POST['email_to'];

// table name
$tbl_name=member;

// retrieve password from table where e-mail = $email_to(mark@phpeasystep.com)
$sql="SELECT password FROM $tbl_name WHERE email='$email_to'";
$result=mysql_query($sql);

// if found this e-mail address, row must be 1 row
// keep value in variable name "$count"
$count=mysql_num_rows($result);

// compare if $count =1 row
if($count==1){

$rows=mysql_fetch_array($result);

// keep password in $your_password
$your_password=$rows['password'];


// ---------------- SEND MAIL FORM ----------------

// send e-mail to ...
$to=$email_to;

// Your subject
$subject="Your password here";

// From
$header="from: your name <your email>";

// Your message
$messages= "Your password for login to our website \r\n";
$messages.="Your password is $your_password \r\n";
$messages.="more message... \r\n";

// send email
$sentmail = mail($to,$subject,$messages,$header);

}

// else if $count not equal 1
else {
echo "Not found your email in our database";
}

// if your email succesfully sent
if($sentmail){
echo "Your Password Has Been Sent To Your Email Address.";
}
else {
echo "Cannot send password to your e-mail address";
}

?>

Once I submit a password, I get the following message

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\apachefriends\xampp\htdocs\runthrowcatch\send_password_ac.php on line 15
Not found your email in our databaseCannot send password to your e-mail address

My Primary key in my database table is loginname and there is no Autoincrement ID number. I am not sure what I need to adjust in this script to make it work. Any assistance would be greatly appreciated.

TOPICS
Server side applications
372
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 11, 2007 Sep 11, 2007
Shedlight wrote:
> I am building my site using Dreamweaver & PHP. I found a forgotten password
> script on PHPeasystep but have found adjusting the script to work on my site
> rather difficult.

Before examining your script, I should point out that in another post,
you're asking about encrypting the password with md5(). This is a
one-way method of encryption. Retrieving a forgotten password has no
meaning whatsoever if it's encrypted. You need to get the user to reset
the password.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 11, 2007 Sep 11, 2007
Thanks very much David on both counts. I am going to use md5 to encrypt my passwords. Could you provide me with some assistance with a reset password & email script.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 12, 2007 Sep 12, 2007
LATEST
Use a random password generator to e-mail a new password to the e-mail
address "on-file". Then set that password as the new password for the
person.


"Shedlight" <webforumsuser@macromedia.com> wrote in message
news:fc75pi$mnd$1@forums.macromedia.com...
> Thanks very much David on both counts. I am going to use md5 to encrypt
> my passwords. Could you provide me with some assistance with a reset
> password & email script.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines