本文整理汇总了PHP中Authentication::suspendUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Authentication::suspendUser方法的具体用法?PHP Authentication::suspendUser怎么用?PHP Authentication::suspendUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authentication
的用法示例。
在下文中一共展示了Authentication::suspendUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Template
<?php
// Access level restriction
Authentication::accessLevelController(8, ">");
// Deal with usr_ban form
if (isset($_GET['action'])) {
if ($_GET['action'] == 'ban' && isset($_POST['user'])) {
Authentication::suspendUser($_POST['user']);
$successAlert = 1;
}
// Deal with unban form
if ($_GET['action'] == 'unban' && isset($_POST['unbanID'])) {
Authentication::reinstateUser($_POST['unbanID']);
$successAlert = 1;
}
if ($_GET['action'] == 'deactivate' && isset($_POST['uid'])) {
Authentication::deactivateUser($_POST['uid']);
$successAlert = 1;
}
}
$sqlSuspend = "SELECT * FROM `users` WHERE `suspended` = '0'";
$resultSuspend = openRailwayCore::dbQuery($sqlSuspend);
$sqlReinstate = "SELECT * FROM `users` WHERE `suspended` = '1'";
$resultReinstate = openRailwayCore::dbQuery($sqlReinstate);
$main = new Template();
$main->set_custom_template("includes/", 'default');
$main->assign_var('ROOT', ROOT);
while ($accountSuspend = mysql_fetch_assoc($resultSuspend)) {
$main->assign_block_vars('user_loop', array('UID' => $accountSuspend['user_id'], 'NAME' => $accountSuspend['username'], 'SID' => $accountSuspend['staff_id']));
}
while ($accountReinstate = mysql_fetch_assoc($resultReinstate)) {
示例2: blockPageToVisitors
/**
* Locks page to non-authenticated browsers
*
*/
public static function blockPageToVisitors()
{
openRailwayCore::dbConnect();
if (isset($_SESSION['session_id'])) {
$result = openRailwayCore::dbQuery("SELECT `session_id` FROM " . SESSIONS_TABLE . " WHERE `session_id` = '" . $_SESSION['session_id'] . "'");
if (mysql_num_rows($result) == 0) {
goto login;
}
}
if (!isset($_SESSION['session_id'])) {
login:
openRailwayCore::pageHeader("Access not authorised");
$template = new Template();
$template->set_custom_template(FROOT . 'theme/' . STYLE, 'default');
if (isset($_GET['l']) && $_GET['l'] == 'fail') {
$template->assign_block_vars('if_login_failed', array());
}
if (isset($_GET['l']) && $_GET['l'] == "logout") {
$template->assign_block_vars('if_logged_out', array());
}
if (isset($_GET['l']) && $_GET['l'] == "flogout") {
$template->assign_block_vars('if_force_logged_out', array());
}
if (isset($_GET['l']) && $_GET['l'] == 'reauth') {
$template->assign_block_vars('if_reauth', array());
} else {
$template->assign_block_vars('if_not_reauth', array());
}
$template->assign_var('ROOT', ROOT);
$template->set_filenames(array('body' => 'login.html'));
$template->display('body');
openRailwayCore::pageFooter();
die;
}
// Check to see if user agent has changed since login, if so log out
if ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT']) {
$interaction = openRailwayCore::createInteractionIdentifier();
openRailwayCore::logEvent(time(), $interaction, $_SESSION['user_id'], 5, 1, "User agent (UID: " . $_SESSION['user_id'] . ") change detected");
Authentication::suspendUser($_SESSION['user_id'], $interaction, 1);
}
}