示例#1
0
    $LANGCODE = 'en';
}
//
// Initalizing static string wrapper
//
PMF_String::init($LANGCODE);
/* header of the admin page */
require 'header.php';
$action = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
$message = '';
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;