当前位置: 首页>>代码示例>>PHP>>正文


PHP account::authenticate方法代码示例

本文整理汇总了PHP中account::authenticate方法的典型用法代码示例。如果您正苦于以下问题:PHP account::authenticate方法的具体用法?PHP account::authenticate怎么用?PHP account::authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在account的用法示例。


在下文中一共展示了account::authenticate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: common

session_start();
$passwordIncorrect = FALSE;
$didNotMatch = FALSE;
// Load the require PHP classes.
require_once '../classes/common.class.php';
require_once '../classes/account.class.php';
$common = new common();
$account = new account();
// Check if the user is logged in.
if (!$account->isAuthenticated()) {
    // The user is not logged in so forward them to the login page.
    header("Location: login.php?origin=" . urlencode('account.php'));
}
if ($common->postBack()) {
    // Check that the user supplied a password matching the one currently stored in administrators.xml.
    $authenticated = $account->authenticate($_SESSION['login'], $_POST['password'], FALSE, FALSE);
    if (!$authenticated) {
        $passwordIncorrect = TRUE;
    }
    if ($_POST['password1'] != $_POST['password2']) {
        $didNotMatch = TRUE;
    }
    if ($authenticated && $_POST['password1'] == $_POST['password2']) {
        // Change the password stored in administrators.xml related to this users login.
        $account->changePassword($_SESSION['login'], $_POST['password1']);
        // Since the password has changed we will log the user out to clear older session variables.
        $account->logout();
    }
}
require_once 'includes/header.inc.php';
/////////////////////
开发者ID:mgunther68,项目名称:adsb-feeder,代码行数:31,代码来源:account.php

示例2: account

$account = new account();
// Check if the user is already logged in.
if ($account->isAuthenticated()) {
    if (isset($_REQUEST['origin'])) {
        // Redirect the authenticated visitor to their original destination.
        header("Location: " . urldecode($_REQUEST['origin']));
    } else {
        // Redirect the user to the administration homepage.
        header("Location: index.php");
    }
}
if ($common->postBack()) {
    // Try to authenticate the user using the credentials supplied.
    $remember = isset($_POST['remember']) ? TRUE : FALSE;
    $origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : NULL;
    $authenticated = $account->authenticate($_POST['login'], $_POST['password'], $remember, TRUE, $origin);
}
/////////////////////
// BEGIN HTML BODY //
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" />
        <link rel="stylesheet" href="assets/css/login.css" />
    </head>
    <body>
        <div class="container">
开发者ID:pinkfroot,项目名称:adsb-feeder,代码行数:31,代码来源:login.php


注:本文中的account::authenticate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。