function f_recover($mode, $f_mailid) { $mode = sanitize($mode); $f_mailid = sanitize($f_mailid); $f_data = f_data(f_id_from_email($f_mailid), 'f_id', 'f_fname', 'f_uname'); if ($mode == 'f_uname') { recovery_user_pass($f_mailid, 'Recovery: Your username', "Hello " . $f_data['f_fname'] . ",\n\nYour username is: " . $f_data['f_uname'] . "\n\n-Swift Airlines"); } else { if ($mode == 'f_password') { $generated_password = substr(md5(rand(999, 999999)), 0, 8); f_change_password($f_data['f_id'], $generated_password); update_f($f_data['f_id'], array('f_passrec' => '1')); recovery_user_pass($f_mailid, 'Recovery: Your password', "Hello " . $f_data['f_fname'] . ",\n\nYour new password is: " . $generated_password . "\n\n-TOFSIS"); } } }
include $_SERVER["DOCUMENT_ROOT"] . '/swift/includes/overall/header.php'; ?> <h3>Change Password</h3> <?php if (isset($_GET['success']) === true && empty($_GET['success']) === true) { echo 'Your password has been changed successfully!'; } else { if (isset($_GET['force']) === true && empty($_GET['force']) === true) { ?> <p>You must change your password to continue using the site!</p> <?php } if (empty($_POST) === false && empty($errors) === true) { f_change_password($session_f_id, $_POST['password']); header('Location: http://localhost/swift/changepass.php?success'); } else { if (empty($errors) === false) { echo output_errors($errors); } } ?> <form action="" method="POST"> Current Password: <br/> <input type="password" name="current_password" /><br/><br/> New Password: <br/> <input type="password" name="password" /><br/><br/> New Password Again: <br/> <input type="password" name="password_again" /><br/><br/>