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


PHP Authentication::suspendUser方法代碼示例

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

示例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);
     }
 }
開發者ID:ralphchadkirk,項目名稱:openRailway,代碼行數:45,代碼來源:auth.class.php


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