include"master_inc.php";
$email = $_REQUEST['email'];
$pw_url = $_REQUEST['password'];
// Connect to server and select databse.
$sql="SELECT * FROM addr_users WHERE email='$email' AND md5_pass ='$pw_url'";
$result=mysqli_query($db,$sql);
// mysqli_num_row is counting table rows
$count=mysqli_num_rows($result);
// If result matches $myusername and $mypassword, table row must be 1 row
if($count==0){
header("location:login_failed.php");
}
//Change to temporary password:
$temp_pw_raw=date("YmdHis");
$encrypted_temp_pw = md5($temp_pw_raw);
$query = "UPDATE `users` SET `password`='$encrypted_temp_pw',`password_hint`='' WHERE `email`='$email'";
// save the info to the database
$results = mysqli_query( $query );
// print out the results
if( $results )
{ echo( "An encrypted temporary password has been assigned. Choose a new password in the form below:
" );
}
else
{
die( "Trouble saving information to the database:
" . mysqli_error() );
}
?>
Password Reset
?>