Пример #1
0
* @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
0
    $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>