ob_start();include_once"config.php"; if(isset($_SESSION['username']) || isset($_SESSION['password'])){ header("Location: membersarea.php"); }else{ if(isset($_POST['lostpassword'])) { $email = $_POST['email']; if($email == NULL) { $final_report.="Please make sure you have completed the form!"; }else{ $query_data = mysql_query("SELECT * FROM `members` WHERE `email`='".$email."'"); if(mysql_num_rows($query_data) == 0){ $final_report.="This email addresss is not in our database."; }else{ $query_data = mysql_query("SELECT * FROM `members` WHERE `email`='".$email."'"); $final_report.="Your details have been sent to your email account."; $get_data = mysql_fetch_array($query_data); $subject = "Membership Details"; $message = "Hello ".$get_data['username'].", Your password is: ".$get_data['password']." Thank you, Silver Bear Cafe This is a automated password response, please do not reply to this email! "; mail($get_data['email'], $subject, $message,"From: ".$site_name." <".$site_email.">\n"); header( 'refresh: 3; url=login.php'); }}}} ?>