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


PHP CUser::logout方法代码示例

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


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

示例1: CUser

<?php

/**
 * This is a Branax pagecontroller.
 *
 */
// Include the essential config-file which also creates the $branax variable with its defaults.
include __DIR__ . '/config.php';
// Create the user object
$user = new CUser($branax['database']);
// Check if user is authenticated
$output = $user->isAuthenticated() ? "Du är inloggad som: {$user->getAcronym()} ({$user->getName()})" : "Du är INTE inloggad.";
// Logout the user
if (isset($_POST['logout'])) {
    $user->logout();
    header('Location: user_status.php');
}
// Do it and store it all in variables in the Anax container.
$branax['title'] = "Logout";
$branax['main'] = <<<EOD
<h1>{$branax['title']}</h1>
<form method=post>
  <fieldset>
  <legend>Logout</legend>
  <p><input type='submit' name='logout' value='Logout'/></p>
  <p><a href='user_login.php'>Login</a></p>
  <output><b>{$output}</b></output>
  </fieldset>
</form>

EOD;
开发者ID:britec,项目名称:branac-base,代码行数:31,代码来源:user_logout.php

示例2: define

** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
require_once 'include/forms.inc.php';
define('ZBX_NOT_ALLOW_ALL_NODES', 1);
define('ZBX_HIDE_NODE_SELECTION', 1);
$page['title'] = 'S_ZABBIX_BIG';
$page['file'] = 'index.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('name' => array(T_ZBX_STR, O_NO, NULL, NOT_EMPTY, 'isset({enter})', S_LOGIN_NAME), 'password' => array(T_ZBX_STR, O_OPT, NULL, NULL, 'isset({enter})'), 'sessionid' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'message' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'reconnect' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 65535), NULL), 'enter' => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), 'form_refresh' => array(T_ZBX_INT, O_OPT, NULL, NULL, NULL), 'request' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL));
check_fields($fields);
$sessionid = get_cookie('zbx_sessionid', null);
if (isset($_REQUEST['reconnect']) && isset($sessionid)) {
    add_audit(AUDIT_ACTION_LOGOUT, AUDIT_RESOURCE_USER, 'Manual Logout');
    CUser::logout($sessionid);
    jsRedirect('index.php');
    exit;
}
$config = select_config();
$authentication_type = $config['authentication_type'];
if ($authentication_type == ZBX_AUTH_HTTP) {
    if (isset($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_USER'])) {
        if (!isset($sessionid)) {
            $_REQUEST['enter'] = 'Enter';
        }
        $_REQUEST['name'] = $_SERVER['PHP_AUTH_USER'];
        $_REQUEST['password'] = 'zabbix';
        //$_SERVER['PHP_AUTH_PW'];
    } else {
        access_deny();
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:index.php


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