logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 04-15-2012, 08:58 PM   #1
richclare1991
 
Join Date: Apr 2012
Posts: 4
Default Forgotten Password

Hi guy's first post try not to slate me too much. Trying to work on a forgotten password feature on a site where the user supplies the email address and then a new random password is sent to the user for them to log in with which they can then edit. It says the email has been sent but when i check my email nothing is there.
Any ideas guys much appreciated?

Heres the code for the page.

<form action="forgottenpasswordform.php" method="POST">

Your Email: <br /> <input type ="text" name="email /> <br />
<input type ="submit" name="submit" value="submit" />
</form>

<?php

$email = @$_POST ['email'];
$submit = @$_POST ['submit'];

include("include/connection.php");

if ($submit) {
$email_check = mysql_query ("SELECT * FROM members WHERE email = '".$email."'");
$count = mysql_num_rows($email_check);

if ($count != 0) {
//generate a new password
$random = rand(72952, 92729);
$new_password = $random;


$email_password = $new_password;

$new_password = md5 ($new_password);

mysql_query("update members set password = '".$new_password."' WHERE email ='".$email."'");

$subject = "Login information";
$message = "Your Password has been changed to $email_password";
$from = "From: example@example.com";


mail ($email, $subject, $message, $from);
echo "Your new password has been emailed to you.";
}

else {
echo "This email does not exist";
}

}
?>
richclare1991 is offline   Reply With Quote
Old 04-16-2012, 02:17 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

echo $email.$subject. $message.$from; to check the values
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 04-16-2012, 01:10 PM   #3
richclare1991
 
Join Date: Apr 2012
Posts: 4
Default

Yeah thank you ive managed to get it working
richclare1991 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:29 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com