本文整理汇总了PHP中UserUtils::update_password方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtils::update_password方法的具体用法?PHP UserUtils::update_password怎么用?PHP UserUtils::update_password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserUtils
的用法示例。
在下文中一共展示了UserUtils::update_password方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_var
* @author Simon Wilkinson
* @version 1.0
* @copyright Copyright (c) 2014 The University of Nottingham
* @package
*/
require '../include/sysadmin_auth.inc';
require_once '../classes/userutils.class.php';
require_once '../include/errors.inc';
$userid = check_var('userID', 'GET', true, false, true);
if (!UserUtils::userid_exists($userid, $mysqli)) {
$msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
$notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
$username = UserUtils::get_username($userid, $mysqli);
$new_password = gen_password();
$success = UserUtils::update_password($username, $new_password, $userid, $mysqli);
if (!$success) {
display_error($string['resetfailed'], $string['failuremsg'], $configObject->get('cfg_root_path') . '/artwork/exclamation_red_bg.png', '#C00000', true, true, true);
}
$mysqli->close();
?>
<!DOCTYPE html>
<html>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html;charset=<?php
echo $configObject->get('cfg_page_charset');
?>
" />
<title><?php
echo $string['passwordreset'] . ' ' . $configObject->get('cfg_install_type');
示例2: VALUES
$stmt = $mysqli->prepare("INSERT INTO temp_users VALUES (NULL, NULL, NULL, NULL, NULL, ?, NOW())");
$stmt->bind_param('s', $free_account);
$stmt->execute();
$stmt->close();
$recordID = $mysqli->insert_id;
// Get the user ID
$stmt = $mysqli->prepare("SELECT id FROM users WHERE username = ?");
$stmt->bind_param('s', $free_account);
$stmt->execute();
$stmt->bind_result($temp_user_id);
$stmt->fetch();
$stmt->close();
// Reset password on the chosen guest account.
$color = array('blue', 'green', 'orange', 'gold', 'silver', 'purple', 'white', 'black', 'yellow');
$random_password = $color[rand(0, 4)] . rand(10, 99);
UserUtils::update_password($free_account, $random_password, $temp_user_id, $mysqli);
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html;charset=<?php
echo $configObject->get('cfg_page_charset');
?>
" />
<title><?php
echo $string['guestaccount'];
?>
</title>