Hi All,
The following script works when username(or email) and password are in 1 table. what i need to know is how to adjust the code to reflect that the email will be held in tbl_email and the password will be held in tbl_master_name .
The following script works when username(or email) and password are in 1 table. what i need to know is how to adjust the code to reflect that the email will be held in tbl_email and the password will be held in tbl_master_name .
Code:
<?php
include ("conn.inc.php");
$username=$_POST["username"];
$res=mysql_query("SELECT username, email FROM tbl_master_name, tbl_email WHERE username='$username'") or die("cannot select from email");
$row=mysql_fetch_array($res);
$email=$row["email"];
srand((double)microtime()*1000000);
$random=rand(1234,2343);
$password=$row["name"].$random;
$upassword=md5($password);
mysql_query("update tbl_master_name set password='$password' where username='$username'") or die("cannot send your password");
$headers ="From: noreply@ACRE.com\n"; //from address
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \n";
$subject ="Password Recovery - Do Not Reply Back To This Email";
$body="<div align=center><br><br>----------------------------- A.C.R.E Password Recovery--------------------------------<br><br><br><br>
Your Temporary Password is: $password<br><br>Remember your password this time or the cow gets it!<br><br><br>Click the link below to log in. <br>http://www.tramp-space.co.uk/assignment/ <br><br> If the link doesnt work, please copy it and paste it into your browser.<br><br> Thank you</div>";
if(mail($email,$subject,$body,$headers)) {echo "<font class=tblackb>Your password has been send to your Registered Email</font> ";}
else {echo "<font class=tblackb>Password Not Send.<br><Br>Please Try Again Later!...</font>";}
?>
Comment