本文整理汇总了PHP中UserData::authenticate方法的典型用法代码示例。如果您正苦于以下问题:PHP UserData::authenticate方法的具体用法?PHP UserData::authenticate怎么用?PHP UserData::authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserData
的用法示例。
在下文中一共展示了UserData::authenticate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: srkRender
require_once $srkEnv->appPath . '/modules/user.php';
require_once $srkEnv->appPath . '/modules/render.php';
if ($srkEnv->reqURLLength == 1 && $srkEnv->reqMethod == 'GET') {
$srkEnv->pageTitle .= '.login';
srkRender('loginpage', array());
} elseif ($srkEnv->reqURLLength >= 2 && $srkEnv->reqURL[2] == 'edit') {
if ($srkEnv->reqMethod == 'GET') {
srkRender('loginman', array());
}
} elseif ($srkEnv->reqURLLength >= 2 && $srkEnv->reqURL[2] == 'auth') {
if ($srkEnv->reqURLLength == 2) {
$userId = $_POST['userId'];
$passwd = $_POST['passwd'];
$user = new UserData();
$user->readUser($userId);
$authRes = $user->authenticate($passwd);
if ($authRes === false) {
$_SESSION['userId'] = $user->id;
srkSend((object) array('res' => 'successful'));
} else {
srkSend((object) array('res' => $authRes));
}
} elseif ($srkEnv->reqURLLength == 3 && $srkEnv->reqURL[3] == 'register') {
$user = new UserData();
$regRes = $user->register($_POST['userId'], $_POST);
if ($regRes->res !== false) {
srkSend($regRes);
} else {
$writeRes = $user->writeUser();
if ($writeRes === false) {
$_SESSION['userId'] = $user->id;
示例2: exit
<?php
if (!defined('srkVersion')) {
exit(403);
}
require_once $srkEnv->appPath . '/modules/file.php';
require_once $srkEnv->appPath . '/modules/user.php';
require_once $srkEnv->appPath . '/modules/pen.php';
require_once $srkEnv->appPath . '/modules/render.php';
require_once $srkEnv->appPath . '/modules/cache.php';
$srkEnv->pageTitle .= '.admin';
$user = new UserData();
if (isset($_POST['userId']) && isset($_POST['passwd'])) {
$user->readUser($_POST['userId']);
$authRes = $user->authenticate($_POST['passwd']);
if ($authRes) {
srkSend((object) array('error' => $authRes));
return;
}
} else {
$user->readUser($_SESSION['userId']);
}
if ($user->status != 'normal') {
if ($srkEnv->reqMethod == 'GET') {
srkRender('error', array('error' => array('status' => '403', 'stack' => 'Access denied')));
} else {
srkSend((object) array('error' => 'Access denied'));
}
return;
} elseif ($srkEnv->reqMethod == 'GET') {
srkRender('admin', array());