本文整理汇总了PHP中Users::logout方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::logout方法的具体用法?PHP Users::logout怎么用?PHP Users::logout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::logout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUserRoles
public function testUserRoles()
{
$app = new Users();
$app->ds->loadMock('users', APP_ROOT . 'data/users.txt');
$app->login('linda@mail.com', '1234');
$this->assertEquals($_SESSION["user_roles"], 2);
$app->logout();
$this->assertEquals($_SESSION["user_roles"], null);
}
示例2: main
/**
* Sandbox main function
*/
public static function main()
{
// Get users table
Users::$users = new Table('users');
// Logout
if (Uri::segment(1) == 'logout') {
Users::logout();
}
}
示例3: __construct
public function __construct($userId = 0)
{
$this->_db = DB::instance();
if (empty($userId)) {
if (Session::exists(Config::get('session/loggedId'))) {
if ($this->setData(Session::get(Config::get('session/loggedId')))) {
$this->_loggedIn = true;
} else {
Users::logout();
}
}
} else {
$this->setData($userId);
}
}
示例4: testUserRoles
public function testUserRoles()
{
$app = new Users();
$data = new data_source_mysqli();
$data->config = self::$config;
$data->connect("");
$app->ds = $data;
$data->index_field = "user_id";
$app->login('linda@mail.com', '1234');
$this->assertEquals($_SESSION["user_roles"], 2);
$app->logout();
$this->assertEquals($_SESSION["user_roles"], null);
}
示例5: testUserDataMethodWithUID
/**
* Tests fetching user's data by calling ::userData with UID argument
*
* (currently it's hardcoded to always return admin's data, since there are no other users)
*/
public function testUserDataMethodWithUID()
{
Users::logout();
$this->assertEquals(self::userData(), Users::userData(0));
Users::login('radex', 'qwerty');
$this->assertEquals(self::userData(), Users::userData(1));
}
示例6: logout
public function logout()
{
Users::logout();
return Response::redirect($this->admin_url . '/login');
}
示例7: Users
<?php
session_start();
include_once 'functions.php';
$user = new Users();
$id = $_SESSION['id'];
if (!$user->session()) {
header('Location: index.php');
}
if ($_GET['q'] == "logout") {
$user->logout();
header('Location: index.php');
}
?>
<h1>Welcome to RubyCMS!</h1>
<p>Although RubyCMS is in pre-alpha development will continue till the developer feels like the CMS is fully complete.
So expect a lot of bugs and please report any bugs to the developer. If you want to logout just click the link below.
Thanks for using RubyCMS, come back any time you want!</p>
<a href="?q=logout">Logout</a>
示例8: signOutAction
function signOutAction()
{
global $site;
Users::logout();
$site->redirectTo($site->urlTo('/experiments/norm-user'));
}
示例9: cc_logout
/**
* Logs the user out and redirects them to the home page.
*/
function cc_logout()
{
Users::logout();
cc_redirect("", true);
exit;
}
示例10: logout_action
function logout_action()
{
Users::logout();
SiteRedirect();
}
示例11: dirname
<?php
/**
* Created by PhpStorm.
* User: renan
* Date: 07/09/15
* Time: 19:17
*/
header('Content-Type: text/html; charset=utf8');
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(__DIR__));
include ROOT . DS . 'config/Config.php';
include ROOT . DS . 'src/Users.php';
$users = new Users(new Config());
$users->logout();
示例12: logout
public function logout()
{
$user = new Users();
$user->logout();
header("Location: " . SITE_URL . "/login");
}
示例13: index
public function index()
{
Users::logout();
Redirect::to(ROOT_URL . 'admincp');
}
示例14: Users
<?php
include_once 'class/user.php';
$obj = new Users();
$obj->table = 'users';
$obj->connect();
if (isset($_GET['logout'])) {
echo $obj->logout();
}
echo $obj->display_logout();
示例15: BasePage
function BasePage()
{
@session_start();
if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc() || ini_get('magic_quotes_sybase')) {
foreach ($_GET as $k => $v) {
$_GET[$k] = is_array($v) ? array_map("stripslashes", $v) : stripslashes($v);
}
foreach ($_POST as $k => $v) {
$_POST[$k] = is_array($v) ? array_map("stripslashes", $v) : stripslashes($v);
}
foreach ($_REQUEST as $k => $v) {
$_REQUEST[$k] = is_array($v) ? array_map("stripslashes", $v) : stripslashes($v);
}
foreach ($_COOKIE as $k => $v) {
$_COOKIE[$k] = is_array($v) ? array_map("stripslashes", $v) : stripslashes($v);
}
}
// set site variable
$s = new Sites();
$this->site = $s->get();
$this->smarty = new Smarty();
if ($this->site->style != "default") {
$this->smarty->addTemplateDir(WWW_DIR . 'templates/' . $this->site->style . '/views/frontend', 'style_frontend');
}
$this->smarty->addTemplateDir(WWW_DIR . 'templates/default/views/frontend', 'frontend');
$this->smarty->setCompileDir(SMARTY_DIR . 'templates_c' . DIRECTORY_SEPARATOR);
$this->smarty->setConfigDir(SMARTY_DIR . 'configs' . DIRECTORY_SEPARATOR);
$this->smarty->setCacheDir(SMARTY_DIR . 'cache' . DIRECTORY_SEPARATOR);
$this->smarty->error_reporting = E_ALL - E_NOTICE;
$this->secure_connection = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443;
if (file_exists(WWW_DIR . 'templates/' . $this->site->style . '/theme.php')) {
require_once WWW_DIR . 'templates/' . $this->site->style . '/theme.php';
}
$this->smarty->assign('themevars', isset($themevars) ? $themevars : null);
$servername = null;
if (defined('EXTERNAL_PROXY_IP') && defined('EXTERNAL_HOST_NAME') && isset($_SERVER["REMOTE_ADDR"]) && $_SERVER["REMOTE_ADDR"] == EXTERNAL_PROXY_IP) {
$servername = EXTERNAL_HOST_NAME;
} elseif (isset($_SERVER["SERVER_NAME"])) {
$servername = $_SERVER["SERVER_NAME"];
}
if ($servername != "") {
$this->serverurl = ($this->secure_connection ? "https://" : "http://") . $servername . ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443" ? ":" . $_SERVER["SERVER_PORT"] : "") . WWW_TOP . '/';
$this->smarty->assign('serverroot', $this->serverurl);
}
$this->page = isset($_GET['page']) ? $_GET['page'] : 'content';
$users = new Users();
if ($users->isLoggedIn()) {
$this->userdata = $users->getById($users->currentUserId());
//
// user can still be logged in but have been disabled by admin, so if they are, log them off
//
if ($this->userdata["role"] == Users::ROLE_DISABLED) {
$users->logout();
$this->show403();
}
$this->userdata["categoryexclusions"] = $users->getCategoryExclusion($users->currentUserId());
//update lastlogin every 15 mins
if (strtotime($this->userdata['now']) - 900 > strtotime($this->userdata['lastlogin'])) {
$users->updateSiteAccessed($this->userdata['ID']);
}
$this->smarty->assign('userdata', $this->userdata);
$this->smarty->assign('loggedin', "true");
if (!empty($this->userdata['nzbvortex_api_key']) && !empty($this->userdata['nzbvortex_server_url'])) {
$this->smarty->assign('weHasVortex', true);
}
$sab = new SABnzbd($this);
if ($sab->integrated !== false && $sab->url != '' && $sab->apikey != '') {
$this->smarty->assign('sabintegrated', $sab->integrated);
$this->smarty->assign('sabapikeytype', $sab->apikeytype);
}
$nzbget = new NZBGet($this);
if ($nzbget->integrated !== false && $nzbget->url != '') {
$this->smarty->assign('nzbgetintegrated', $nzbget->integrated);
}
if ($this->userdata["role"] == Users::ROLE_ADMIN) {
$this->smarty->assign('isadmin', "true");
}
if ($this->userdata["hideads"] == "1") {
$this->site->adheader = "";
$this->site->adbrowse = "";
$this->site->addetail = "";
}
$this->floodCheck($this->userdata["role"]);
} else {
$this->smarty->assign('isadmin', "false");
$this->smarty->assign('loggedin', "false");
$this->floodCheck();
}
$this->smarty->assign('site', $this->site);
$this->smarty->assign('page', $this);
}