本文整理汇总了PHP中Session::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::destroy方法的具体用法?PHP Session::destroy怎么用?PHP Session::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::destroy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logoutAction
public function logoutAction($key = 'user')
{
Session::remove($key);
Session::destroy();
Session::setFlash(__t('you_logout'));
$this->redirect("/");
}
示例2: handleLogin
public static function handleLogin()
{
Session::init();
if ($_SESSION['user_logged_in'] == false) {
Session::destroy();
}
}
示例3: render
/**
* simply includes (=shows) the view. this is done from the controller. In the controller, you usually say
* $this->view->render('help/index'); to show (in this example) the view index.php in the folder help.
* Usually the Class and the method are the same like the view, but sometimes you need to show different views.
* @param string $filename Path of the to-be-rendered view, usually folder/file(.php)
* @param boolean $render_without_header_and_footer Optional: Set this to true if you don't want to include header and footer
*/
public function render($filename, $render_without_header_and_footer = false)
{
// page without header and footer, for whatever reason
if (isset($_SESSION['LAST_ACTIVITY']) && time() - $_SESSION['LAST_ACTIVITY'] > 3600) {
// session started more than 30 minutes ago
session_unset();
Session::destroy();
// update creation time
$_SESSION["feedback_negative"][] = 'Logged out for inactivity';
//require VIEWS_PATH . '_templates/header.php';
//require VIEWS_PATH . '_templates/sidebar.php';
require VIEWS_PATH . 'login/index' . '.php';
//require VIEWS_PATH . '_templates/footer.php';
} else {
$_SESSION['LAST_ACTIVITY'] = time();
//everytime new view is rendered update activity
if ($render_without_header_and_footer == true) {
require VIEWS_PATH . $filename . '.php';
} else {
require VIEWS_PATH . '_templates/header.php';
//require VIEWS_PATH . '_templates/sidebar.php';
require VIEWS_PATH . $filename . '.php';
//require VIEWS_PATH . '_templates/footer.php';
}
}
}
示例4: getUrl
public function getUrl()
{
switch (Session::get('sess_codigo_cliente_url')) {
case '3f7a2611ee08c6645796463e0bb1ae7f':
Session::set('sess_boton_pago', true);
Session::set('sess_iframe', false);
Session::set('sess_condiciones', 'travelclub');
Session::set('sess_user_hash', 'E3ra79');
return 'http://hoteles.travelclub.cl/es';
break;
case '__OTRO__':
Session::destroy('sess_boton_pago');
Session::set('sess_iframe', false);
Session::set('sess_condiciones', 'panamericana');
Session::set('sess_user_hash', false);
return 'http://hoteles.travelclub.cl/es';
break;
default:
Session::destroy('sess_boton_pago');
//DESCOMENTAR
//Session::set('sess_boton_pago', true); //COMENTAR
Session::set('sess_iframe', true);
Session::set('sess_condiciones', 'panamericana');
Session::set('sess_user_hash', false);
return 'http://www.panamericanaturismo.cl';
break;
}
}
示例5: destroySession
function destroySession()
{
Session::init();
Session::destroy();
print_r($_SESSION);
header("location: " . URL);
}
示例6: runPage
protected function runPage()
{
Session::destroy();
global $cScriptPath;
$this->mHeaders[] = "HTTP/1.1 303 See Other";
$this->mHeaders[] = "Location: " . $cScriptPath;
}
示例7: runPage
protected function runPage()
{
Session::destroy();
global $cWebPath;
$this->mHeaders[] = "HTTP/1.1 303 See Other";
$this->mHeaders[] = "Location: " . $cWebPath . "/management.php/Login";
}
示例8: deauthUser
public function deauthUser()
{
// simple message to show where you are
echo 'Message from Controller: You are in the Controller: Users, using the method deauthUser().';
Session::destroy();
header('location: ' . URL . 'home/index');
}
示例9: update
public function update($token_id)
{
if (isset($_SESSION['token_id'])) {
Session::destroy($token_id);
Session::destroy('token_id');
}
}
示例10: SignIn
function SignIn($row)
{
Module::Module($row);
if (User::is_login()) {
if ($data = Session::get('user_data') and $data['home_page']) {
Url::redirect_url($data['home_page']);
} else {
Url::redirect('home');
}
} else {
// xoa toan bo du lieu dang co truoc khi dang nhap
if (Session::is_set('user_id')) {
$id = Session::get('user_id');
DB::update('account', array('last_online_time' => time()), 'id=\'' . $id . '\'');
setcookie('user_id', "", time() - 3600);
Session::destroy('user_id');
}
//if(URL::get("m")== "mobile"){
// require_once 'forms/mlogin.php';
// $this->add_form(new SignInmForm);
//}else{
require_once 'forms/sign_in.php';
$this->add_form(new SignInForm());
//}
}
}
示例11: logout
function logout()
{
Session::init();
Session::destroy();
header('location:' . URL . 'admincp');
exit;
}
示例12: ingresar
public function ingresar()
{
try {
$user = $this->getTexto('txtLogin');
$pass = $this->getTexto('txtContraseña');
if (!empty($user) && !empty($pass)) {
$objUser = $this->_login->getUsuario($user);
if ($objUser) {
if (strtolower($objUser[0]->getUsername()) == $user && $objUser[0]->getPassword() == crypt($pass, 'SMSYS')) {
Session::set('SESS_USER', $objUser[0]->getUsername());
if (Session::get('SESS_ERRLOGIN') != null) {
Session::destroy('SESS_ERRLOGIN');
}
header('Location: ' . BASE_URL . 'sistema');
} else {
//Session::set('SESS_ERRLOGIN',$user.' '.$pass);
Session::set('SESS_ERRLOGIN', 'Usuario o contraseña incorrectos');
header('Location: ' . BASE_URL . 'login');
}
} else {
//Session::set('SESS_ERRLOGIN',$user.' '.$pass);
Session::set('SESS_ERRLOGIN', 'No existe ese usuario registrado');
header('Location: ' . BASE_URL . 'login');
}
}
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
示例13: logout
/**
* logout
*
* This is called when you want to log out and nuke your session.
* This is the function used for the Ajax logouts, if no id is passed
* it tries to find one from the session,
*/
public static function logout($key = '', $relogin = true)
{
// If no key is passed try to find the session id
$key = $key ? $key : session_id();
// Nuke the cookie before all else
Session::destroy($key);
if (!$relogin && AmpConfig::get('logout_redirect')) {
$target = AmpConfig::get('logout_redirect');
} else {
$target = AmpConfig::get('web_path') . '/login.php';
}
// Do a quick check to see if this is an AJAXed logout request
// if so use the iframe to redirect
if (defined('AJAX_INCLUDE')) {
ob_end_clean();
ob_start();
xoutput_headers();
$results = array();
$results['rfc3514'] = '<script type="text/javascript">reloadRedirect("' . $target . '")</script>';
echo xoutput_from_array($results);
} else {
/* Redirect them to the login page */
header('Location: ' . $target);
}
exit;
}
示例14: logout
/**
* Log out a user by removing the related session variables.
*
* @param boolean $destroy completely destroy the session
* @return boolean
*/
public function logout($destroy = false)
{
// Delete the autologin cookie to prevent re-login
if (cookie::get($this->config['cookie_name'])) {
cookie::delete($this->config['cookie_name']);
}
// Logout 3rd party?
if (FB::enabled() && Visitor::instance()->get_provider()) {
$this->session->delete($this->config['session_key'] . '_provider');
try {
FB::instance()->expire_session();
} catch (Exception $e) {
}
}
// Destroy the session completely?
if ($destroy === true) {
$this->session->destroy();
} else {
// Remove the user from the session
$this->session->delete($this->config['session_key']);
// Regenerate session_id
$this->session->regenerate();
}
// Double check
return !$this->logged_in();
}
示例15: _init
/**
* Initialize by loading config & starting default session
*/
public static function _init()
{
\Config::load('session', true);
if (\Config::get('session.auto_initialize', true)) {
static::instance();
}
if (\Config::get('session.native_emulation', false)) {
// emulate native PHP sessions
session_set_save_handler(function ($savePath, $sessionName) {
}, function () {
}, function ($sessionId) {
// copy all existing session vars into the PHP session store
$_SESSION = \Session::get();
$_SESSION['__org'] = $_SESSION;
}, function ($sessionId, $data) {
// get the original data
$org = isset($_SESSION['__org']) ? $_SESSION['__org'] : array();
unset($_SESSION['__org']);
// do we need to remove stuff?
if ($remove = array_diff_key($org, $_SESSION)) {
\Session::delete(array_keys($remove));
}
// add or update the remainder
empty($_SESSION) or \Session::set($_SESSION);
}, function ($sessionId) {
\Session::destroy();
}, function ($lifetime) {
});
}
}