本文整理汇总了PHP中SessionController::logout方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionController::logout方法的具体用法?PHP SessionController::logout怎么用?PHP SessionController::logout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionController
的用法示例。
在下文中一共展示了SessionController::logout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
require $_SERVER['DOCUMENT_ROOT'] . "/resources/scripts/initialize.php";
SessionController::logout();
gtRequire("scripts/redirect.php");
示例2: __construct
public function __construct($route)
{
if (!isset($_SESSION)) {
session_start();
}
if (!isset($_SESSION['ok'])) {
$_SESSION['ok'] = false;
}
if ($_SESSION['ok']) {
//accedemos con user y pass correcto a la plicación
//echo '<h2>Bienvenido <mark>' . $_SESSION['user'] . '</mark> a Mexflix te has autenticado</h2>';
$this->route = isset($_GET['r']) ? $_GET['r'] : 'home';
$controller = new ViewController();
switch ($this->route) {
case 'home':
$controller->load_view('home');
break;
case 'movieseries':
case 'movieseries':
if (!isset($_POST['r'])) {
$controller->load_view('movieseries');
} else {
if ($_POST['r'] == 'movieserie-add') {
$controller->load_view('movieserie-add');
} else {
if ($_POST['r'] == 'movieserie-edit') {
$controller->load_view('movieserie-edit');
} else {
if ($_POST['r'] == 'movieserie-delete') {
$controller->load_view('movieserie-delete');
} else {
if ($_POST['r'] == 'movieserie-show') {
$controller->load_view('movieserie-show');
}
}
}
}
}
break;
case 'usuarios':
if (!isset($_POST['r'])) {
$controller->load_view('users');
} else {
if ($_POST['r'] == 'user-add') {
$controller->load_view('user-add');
} else {
if ($_POST['r'] == 'user-edit') {
$controller->load_view('user-edit');
} else {
if ($_POST['r'] == 'user-delete') {
$controller->load_view('user-delete');
}
}
}
}
break;
case 'status':
if (!isset($_POST['r'])) {
$controller->load_view('status');
} else {
if ($_POST['r'] == 'status-add') {
$controller->load_view('status-add');
} else {
if ($_POST['r'] == 'status-edit') {
$controller->load_view('status-edit');
} else {
if ($_POST['r'] == 'status-delete') {
$controller->load_view('status-delete');
}
}
}
}
break;
case 'salir':
$user_session = new SessionController();
$user_session->logout();
break;
default:
$controller->load_view('error404');
break;
}
} else {
//la aplicación nos muestra un form de login
if (!isset($_POST['user']) && !isset($_POST['pass'])) {
//echo 'Tengo que mostrar un login form';
$login_form = new ViewController();
$login_form->load_view('login');
} else {
//echo 'Validar los datos que el usuario envía';
$user_session = new SessionController();
$session = $user_session->login($_POST['user'], $_POST['pass']);
if (empty($session)) {
//echo 'El usuario y el password son incorrectos';
$login_form = new ViewController();
$login_form->load_view('login');
header('Location: ./?error=El usuario ' . $_POST['user'] . ' y el password proporcionado no coinciden');
} else {
//echo 'El usuario y el password son correctos';
//var_dump($session);
$_SESSION['ok'] = true;
//.........这里部分代码省略.........