本文整理汇总了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"]);