MySQL Forums
Forum List  »  PHP

forgot password? function not working
Posted by: Lisa Fox
Date: September 02, 2005 10:20PM

Hi-

I have a retrieve password function that checks the user's memberID against a security question. If all goes well, the user is emailed their password they set up upon registration.

I can't for the life of me get the email addy from the database to populate into the mail function. Can someone please take a look at this code and tell me if I've got something wrong?

CODE:
elseif($_GET['function']=='retrieve') {

$Member_ID = $_POST['Member_ID'];
include "inc/member_password_retrieve.inc";
}
elseif($_GET['function']=='getpassword') {

include "inc/header.inc";
$Member_ID = $_POST['Member_ID'];
$Password_Answer = $_POST['Password_Answer'];
openDB();
$selectString = "select Password, email from member_profile where Member_ID = '$Member_ID'and Password_Answer = '$Password_Answer'";
$recordSet = mysql_query($selectString);
if(mysql_num_rows($recordSet)==0) {
include "inc/member_password_no_match.inc";
}
else {
$row = mysql_fetch_row($recordSet);
$email = $row[1];
$Password = $row[0];
include ('Mail.php');
$recipients = "$email";
$headers['From'] = 'DoNotReply@site.com';
$headers['To'] = "$email";
$headers['Subject'] = "Password for $Member_ID";

$body = "Here is the password you requested:\n\n$Password\n\nLogin in at www.site.com";

$params['sendmail_path'] = '/usr/sbin/sendmail -t -i';

// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory('sendmail', $params);

$mail_object->send($recipients, $headers, $body);

I'm not getting any error messages at all. If I actually type in my email address in the 'To' header it gets sent to me, so I know that the server is capable of sending emails.

I've been tweaking with this for a week now, any help is greatly appreciated.

Thank you-
Lisa

Options: ReplyQuote


Subject
Written By
Posted
forgot password? function not working
September 02, 2005 10:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.