Hi, i have a database which contains passwords which have been encrypted using the MD5 function. The problem is i want to have a forgot password area that sends the password to the email address in the database but when it does send it is still encrypted, how can i unencrypt it for sending.
This is the code:
<?php
if ($_GET['forgot_action']=="submit"){
$uname = mysql_escape_string($_POST['uname']);
$email = mysql_escape_string($_POST['email']);
$forgot_info = "SELECT * FROM clients WHERE username = '$uname' OR email = '$email'";
$forgot_info_result = mysql_query($forgot_info);
$forgot_info_number = mysql_num_rows($forgot_info_result);
$forgot_info_row = mysql_fetch_assoc($forgot_info_result);
$password = $forgot_info_row['password'];
$send_email = $forgot_info_row['email'];
$username = $forgot_info_row['username'];
if ($forgot_info_result){
mail("$send_email","Requested Information","This is an automatic response for the information you requested. The information is listed below.
Username: $username
Password: $password");?>
<span class="maintext">Your information has been sent to <?php echo $forgot_info_row['email']; ?>.</span>
<?php
}
}
?>
Also if the username or email address does not exist in the database how do i create an error page as it does not seam to work the way i was trying.
Thanks, Darren