當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authentication::changePassword方法代碼示例

本文整理匯總了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'])) {
開發者ID:Carlos110988,項目名稱:statuspage,代碼行數:31,代碼來源:users.php

示例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">
開發者ID:loginradius,項目名稱:php-sdk,代碼行數:31,代碼來源:profile.php


注:本文中的Authentication::changePassword方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。