本文整理匯總了PHP中strings::randomString方法的典型用法代碼示例。如果您正苦於以下問題:PHP strings::randomString方法的具體用法?PHP strings::randomString怎麽用?PHP strings::randomString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類strings
的用法示例。
在下文中一共展示了strings::randomString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
messages::messageChangeSaved(MENU_NEW_PASS, MESSAGE_NEW_PASS_CONFIRM, chpu::createChpuUrl(CONF_SCRIPT_URL . 'index.php?ut=' . $_SESSION['sd_user'][DB_PREFIX . 'conf']['user_type']), 10000);
} else {
$arrErrors[] = ERROR_SEND_EMAIL;
}
} else {
$arrErrors[] = ERROR_EMAIL_NOT_FOUND;
}
}
} else {
$arrErrors[] = ERROR_EMPTY_FIELDS;
}
$smarty->assign('return_data', array('email' => $_POST['email']));
} elseif (isset($_GET['i']) && $_GET['i']) {
if ($userData = $user->checkLinkToChangePassword()) {
// генерируем новый пароль
$password = strings::randomString(CONF_REGISTER_USER_PASSWORD);
$mailer = new mailer();
// массив для замены в шаблоне
$mailer->setAddReplace(array('%NEW_PASSWORD%' => $password));
if ($mailer->sendEmail(CONF_MAIL_ADMIN_EMAIL, false, false, $userData['email'], $userData['email'], CONF_SITE_NAME . MAIL_SUBJ_NEW_PASS, 'new.pass.txt')) {
// если письмо успешно отправлено, обновляем пароль
if ($user->updateUser(array('password' => md5($password)), "id IN (" . secure::escQuoteData($userData['id']) . ") AND password IN (" . secure::escQuoteData($userData['password']) . ")")) {
messages::messageChangeSaved(MENU_NEW_PASS, MESSAGE_NEW_PASS_SUCCESS, chpu::createChpuUrl(CONF_SCRIPT_URL . 'index.php?ut=' . $_SESSION['sd_user'][DB_PREFIX . 'conf']['user_type'] . '&do=authorize'), 10000);
} else {
$arrErrors[] = db::$message_error;
}
} else {
$arrErrors[] = ERROR_SEND_EMAIL;
}
} else {
messages::error404();