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


PHP Auth_Controller::action_logout方法代码示例

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


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

示例1: action_deleteaccount2

 /**
  * Actually delete an account.
  */
 public function action_deleteaccount2()
 {
     global $user_info, $context, $cur_profile, $user_profile, $modSettings;
     // Try get more time...
     @set_time_limit(600);
     // @todo Add a way to delete pms as well?
     if (!$context['user']['is_owner']) {
         isAllowedTo('profile_remove_any');
     } elseif (!allowedTo('profile_remove_any')) {
         isAllowedTo('profile_remove_own');
     }
     checkSession();
     $memID = currentMemberID();
     // Check we got here as we should have!
     if ($cur_profile != $user_profile[$memID]) {
         fatal_lang_error('no_access', false);
     }
     $old_profile =& $cur_profile;
     // This file is needed for our utility functions.
     require_once SUBSDIR . '/Members.subs.php';
     // Too often, people remove/delete their own only administrative account.
     if (in_array(1, explode(',', $old_profile['additional_groups'])) || $old_profile['id_group'] == 1) {
         // Are you allowed to administrate the forum, as they are?
         isAllowedTo('admin_forum');
         $another = isAnotherAdmin($memID);
         if (empty($another)) {
             fatal_lang_error('at_least_one_admin', 'critical');
         }
     }
     // Do you have permission to delete others profiles, or is that your profile you wanna delete?
     if ($memID != $user_info['id']) {
         isAllowedTo('profile_remove_any');
         // Now, have you been naughty and need your posts deleting?
         // @todo Should this check board permissions?
         if ($_POST['remove_type'] != 'none' && allowedTo('moderate_forum')) {
             // Include subs/Topic.subs.php - essential for this type of work!
             require_once SUBSDIR . '/Topic.subs.php';
             require_once SUBSDIR . '/Messages.subs.php';
             // First off we delete any topics the member has started - if they wanted topics being done.
             if ($_POST['remove_type'] == 'topics') {
                 // Fetch all topics started by this user.
                 $topicIDs = topicsStartedBy($memID);
                 // Actually remove the topics.
                 // @todo This needs to check permissions, but we'll let it slide for now because of moderate_forum already being had.
                 removeTopics($topicIDs);
             }
             // Now delete the remaining messages.
             removeNonTopicMessages($memID);
         }
         // Only delete this poor member's account if they are actually being booted out of camp.
         if (isset($_POST['deleteAccount'])) {
             deleteMembers($memID);
         }
     } elseif (!empty($modSettings['approveAccountDeletion']) && !allowedTo('moderate_forum')) {
         // Setup their account for deletion ;)
         updateMemberData($memID, array('is_activated' => 4));
         // Another account needs approval...
         updateSettings(array('unapprovedMembers' => true), true);
     } else {
         deleteMembers($memID);
         require_once CONTROLLERDIR . '/Auth.controller.php';
         $controller = new Auth_Controller();
         $controller->action_logout(true);
         redirectexit();
     }
 }
开发者ID:joshuaadickerson,项目名称:Elkarte,代码行数:69,代码来源:ProfileAccount.controller.php

示例2: is_not_banned


//.........这里部分代码省略.........
            }
            $db->free_result($request);
        }
        // Mark the cannot_access and cannot_post bans as being 'hit'.
        if (isset($_SESSION['ban']['cannot_access']) || isset($_SESSION['ban']['cannot_post']) || isset($_SESSION['ban']['cannot_login'])) {
            log_ban(array_merge(isset($_SESSION['ban']['cannot_access']) ? $_SESSION['ban']['cannot_access']['ids'] : array(), isset($_SESSION['ban']['cannot_post']) ? $_SESSION['ban']['cannot_post']['ids'] : array(), isset($_SESSION['ban']['cannot_login']) ? $_SESSION['ban']['cannot_login']['ids'] : array()));
        }
        // If for whatever reason the is_activated flag seems wrong, do a little work to clear it up.
        if ($user_info['id'] && ($user_settings['is_activated'] >= 10 && !$flag_is_activated || $user_settings['is_activated'] < 10 && $flag_is_activated)) {
            require_once SUBSDIR . '/Bans.subs.php';
            updateBanMembers();
        }
    }
    // Hey, I know you! You're ehm...
    if (!isset($_SESSION['ban']['cannot_access']) && !empty($_COOKIE[$cookiename . '_'])) {
        $bans = explode(',', $_COOKIE[$cookiename . '_']);
        foreach ($bans as $key => $value) {
            $bans[$key] = (int) $value;
        }
        $request = $db->query('', '
			SELECT bi.id_ban, bg.reason
			FROM {db_prefix}ban_items AS bi
				INNER JOIN {db_prefix}ban_groups AS bg ON (bg.id_ban_group = bi.id_ban_group)
			WHERE bi.id_ban IN ({array_int:ban_list})
				AND (bg.expire_time IS NULL OR bg.expire_time > {int:current_time})
				AND bg.cannot_access = {int:cannot_access}
			LIMIT ' . count($bans), array('cannot_access' => 1, 'ban_list' => $bans, 'current_time' => time()));
        while ($row = $db->fetch_assoc($request)) {
            $_SESSION['ban']['cannot_access']['ids'][] = $row['id_ban'];
            $_SESSION['ban']['cannot_access']['reason'] = $row['reason'];
        }
        $db->free_result($request);
        // My mistake. Next time better.
        if (!isset($_SESSION['ban']['cannot_access'])) {
            require_once SUBSDIR . '/Auth.subs.php';
            $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
            elk_setcookie($cookiename . '_', '', time() - 3600, $cookie_url[1], $cookie_url[0], false, false);
        }
    }
    // If you're fully banned, it's end of the story for you.
    if (isset($_SESSION['ban']['cannot_access'])) {
        require_once SUBSDIR . '/Auth.subs.php';
        // We don't wanna see you!
        if (!$user_info['is_guest']) {
            require_once CONTROLLERDIR . '/Auth.controller.php';
            $controller = new Auth_Controller();
            $controller->action_logout(true, false);
        }
        // 'Log' the user out.  Can't have any funny business... (save the name!)
        $old_name = isset($user_info['name']) && $user_info['name'] != '' ? $user_info['name'] : $txt['guest_title'];
        $user_info['name'] = '';
        $user_info['username'] = '';
        $user_info['is_guest'] = true;
        $user_info['is_admin'] = false;
        $user_info['permissions'] = array();
        $user_info['id'] = 0;
        $context['user'] = array('id' => 0, 'username' => '', 'name' => $txt['guest_title'], 'is_guest' => true, 'is_logged' => false, 'is_admin' => false, 'is_mod' => false, 'can_mod' => false, 'language' => $user_info['language']);
        // A goodbye present.
        $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
        elk_setcookie($cookiename . '_', implode(',', $_SESSION['ban']['cannot_access']['ids']), time() + 3153600, $cookie_url[1], $cookie_url[0], false, false);
        // Don't scare anyone, now.
        $_GET['action'] = '';
        $_GET['board'] = '';
        $_GET['topic'] = '';
        writeLog(true);
        // You banned, sucka!
        fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_access']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_access']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], standardTime($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']), 'user');
        // If we get here, something's gone wrong.... but let's try anyway.
        trigger_error('Hacking attempt...', E_USER_ERROR);
    } elseif (isset($_SESSION['ban']['cannot_login']) && !$user_info['is_guest']) {
        // We don't wanna see you!
        $db->query('', '
			DELETE FROM {db_prefix}log_online
			WHERE id_member = {int:current_member}', array('current_member' => $user_info['id']));
        // 'Log' the user out.  Can't have any funny business... (save the name!)
        $old_name = isset($user_info['name']) && $user_info['name'] != '' ? $user_info['name'] : $txt['guest_title'];
        $user_info['name'] = '';
        $user_info['username'] = '';
        $user_info['is_guest'] = true;
        $user_info['is_admin'] = false;
        $user_info['permissions'] = array();
        $user_info['id'] = 0;
        $context['user'] = array('id' => 0, 'username' => '', 'name' => $txt['guest_title'], 'is_guest' => true, 'is_logged' => false, 'is_admin' => false, 'is_mod' => false, 'can_mod' => false, 'language' => $user_info['language']);
        // Wipe 'n Clean(r) erases all traces.
        $_GET['action'] = '';
        $_GET['board'] = '';
        $_GET['topic'] = '';
        writeLog(true);
        // Log them out
        require_once CONTROLLERDIR . '/Auth.controller.php';
        $controller = new Auth_Controller();
        $controller->action_logout(true, false);
        // Tell them thanks
        fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_login']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_login']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], standardTime($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']) . '<br />' . $txt['ban_continue_browse'], 'user');
    }
    // Fix up the banning permissions.
    if (isset($user_info['permissions'])) {
        banPermissions();
    }
}
开发者ID:Ralkage,项目名称:Elkarte,代码行数:101,代码来源:Security.php


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