本文整理汇总了PHP中Authentication::changePassword方法的典型用法代码示例。如果您正苦于以下问题:PHP Authentication::changePassword方法的具体用法?PHP Authentication::changePassword怎么用?PHP Authentication::changePassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authentication
的用法示例。
在下文中一共展示了Authentication::changePassword方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Authentication
<?php
require_once '../includes/base.inc.php';
$auth = new Authentication();
$users = new Users();
if (!isset($_SESSION['auth']['id'])) {
header('Location: index.php');
exit;
}
if (!empty($_POST)) {
if (!empty($_POST['oldpw']) && !empty($_POST['newpw']) && !empty($_POST['newpw2'])) {
if ($_POST['newpw'] == $_POST['newpw2']) {
$change = $auth->changePassword($_SESSION['auth']['user'], $_POST['oldpw'], $_POST['newpw']);
if ($change == false) {
$smarty->assign('error', 'Unable to change password. Please try again');
} else {
$smarty->assign('error', 'Your password has been changed');
}
} else {
$smarty->assign('error', 'New passwords do not match');
}
}
if (!empty($_POST['user']) && !empty($_POST['pass'])) {
$add = $users->createUser($_POST['user'], $_POST['pass']);
if ($add != false) {
header('Location: users.php');
}
$smarty->assign('error', 'Unable to create user. Please try again');
}
}
if (!empty($_GET['delete'])) {
示例2: header
//If user is not logged in then return to index page
if (!isset($_SESSION['user_id'])) {
header("Location: index.php");
exit;
}
$post_value = $_POST;
//Check logout request.
if (isset($post_value['value']) && $post_value['value'] == 'logout') {
//Call logout function
Authentication::logout();
} elseif (!empty($post_value['update'])) {
//Call Update profile function
Authentication::updateProfile($post_value);
} elseif (isset($post_value['newpassword']) && !empty($post_value['newpassword'])) {
//Call change Password function
Authentication::changePassword($post_value);
} elseif (isset($post_value['password']) && !empty($post_value['password'])) {
//Call Set password function
Authentication::setPassword($post_value);
} elseif (isset($post_value['value']) && $post_value['value'] == 'accountUnLink') {
//Call Update profile function
Authentication::unlinkAccount($post_value);
} elseif (isset($post_value['value']) && $post_value['value'] == 'accountLink') {
//Call Update profile function
Authentication::linkAccount($post_value);
}
$data = $_SESSION['userprofile'];
include_once 'includes/header.php';
?>
<!-- Add Profile page content-->
<div class="lr-profile-frame lr-input-style">