本文整理匯總了PHP中PMF_User_CurrentUser::changePassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP PMF_User_CurrentUser::changePassword方法的具體用法?PHP PMF_User_CurrentUser::changePassword怎麽用?PHP PMF_User_CurrentUser::changePassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PMF_User_CurrentUser
的用法示例。
在下文中一共展示了PMF_User_CurrentUser::changePassword方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
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: " . $username . "\nNew Password: " . $newPassword . "\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"]);