if ($action == "sendmail") { $username = PMF_Filter::filterInput(INPUT_POST, 'username', FILTER_SANITIZE_STRING); $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL); if (!is_null($username) && !is_null($email)) { $user = new PMF_User_CurrentUser(); $loginExist = $user->getUserByLogin($username); if ($loginExist && $email == $user->getUserData('email')) { $consonants = array('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z'); $vowels = array('a', 'e', 'i', 'o', 'u'); $newPassword = ''; srand((double) microtime() * 1000000); for ($i = 1; $i <= 4; $i++) { $newPassword .= $consonants[rand(0, 19)]; $newPassword .= $vowels[rand(0, 4)]; } $user->changePassword($newPassword); $text = $PMF_LANG['lostpwd_text_1'] . "\nUsername: "******"\nNew Password: "******"\n\n" . $PMF_LANG["lostpwd_text_2"]; $mail = new PMF_Mail(); $mail->addTo($email); $mail->subject = '[%sitename%] Username / password request'; $mail->message = $text; $result = $mail->send(); unset($mail); // Trust that the email has been sent $message = sprintf('<p class="success">%s</p>', $PMF_LANG["lostpwd_mail_okay"]); print "<p><img src=\"images/arrow.gif\" width=\"11\" height=\"11\" alt=\"" . $PMF_LANG["ad"] . "\" border=\"0\" /> <a href=\"index.php\" title=\"" . $PMF_LANG["ad"] . "\">" . $PMF_LANG["ad"] . "</a></p>"; } else { $message = sprintf('<p class="error">%s</p>', $PMF_LANG["lostpwd_err_1"]); } } else { $message = sprintf('<p class="error">%s</p>', $PMF_LANG["lostpwd_err_2"]);