<? include 'db.php'; switch($_POST['recover']){ default: include 'lost_pw.html'; break; case "recover": recover_pw($_POST['email_address']); break; } function recover_pw($email_address){ if(!$email_address){ include 'lost_pw.html'; } // quick check to see if record exists if($sql_check_num == 0){ include 'lost_pw.html'; } // Everything looks ok, update it and send it! $sql = mysql_query("UPDATE users SET password='$db_password' WHERE email_address='$email_address'"); $subject = "Your Password at MyWebsite!"; $message = "Hi $first_name your username and password is. Username:$username Password:$password <a href="http://www.cos-tam.pl/login_form.html" target="_blank">http://www.cos-tam.pl/login_form.html</a> Thanks! The Webmaster This is an automated response, please do not reply!"; mail($email_address, $subject, $message, "From: costam<costam@o2.pl>\nX-Mailer: PHP/" . phpversion()); include 'password.html'; } ?>