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


PHP Session::destroy方法代码示例

本文整理汇总了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("/");
 }
开发者ID:artemkuchma,项目名称:php_academy_site2,代码行数:7,代码来源:SecurityController.php

示例2: handleLogin

 public static function handleLogin()
 {
     Session::init();
     if ($_SESSION['user_logged_in'] == false) {
         Session::destroy();
     }
 }
开发者ID:ikaldesign,项目名称:php-login,代码行数:7,代码来源:Auth.php

示例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';
         }
     }
 }
开发者ID:shuoppy,项目名称:leviathan,代码行数:33,代码来源:View.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;
     }
 }
开发者ID:JonathanEstay,项目名称:panamericanaturismo.cl,代码行数:28,代码来源:Buscador.php

示例5: destroySession

 function destroySession()
 {
     Session::init();
     Session::destroy();
     print_r($_SESSION);
     header("location: " . URL);
 }
开发者ID:joshluq,项目名称:sysexcel,代码行数:7,代码来源:Usuario.php

示例6: runPage

 protected function runPage()
 {
     Session::destroy();
     global $cScriptPath;
     $this->mHeaders[] = "HTTP/1.1 303 See Other";
     $this->mHeaders[] = "Location: " . $cScriptPath;
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:7,代码来源:PageLogout.php

示例7: runPage

 protected function runPage()
 {
     Session::destroy();
     global $cWebPath;
     $this->mHeaders[] = "HTTP/1.1 303 See Other";
     $this->mHeaders[] = "Location: " . $cWebPath . "/management.php/Login";
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:7,代码来源:MPageLogout.php

示例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');
 }
开发者ID:rmrighes,项目名称:mps.br-medicao,代码行数:7,代码来源:users.php

示例9: update

 public function update($token_id)
 {
     if (isset($_SESSION['token_id'])) {
         Session::destroy($token_id);
         Session::destroy('token_id');
     }
 }
开发者ID:RamiroAlvaro,项目名称:ProyectoDeSoftware,代码行数:7,代码来源:Csrf.php

示例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());
         //}
     }
 }
开发者ID:nguyenxuantung,项目名称:Website_Quan_Ly_Nha_Hang,代码行数:26,代码来源:class.php

示例11: logout

 function logout()
 {
     Session::init();
     Session::destroy();
     header('location:' . URL . 'admincp');
     exit;
 }
开发者ID:trongloikt192,项目名称:Project_Wahanda_Alternative,代码行数:7,代码来源:admincp_model.php

示例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();
     }
 }
开发者ID:spellbring,项目名称:MVC,代码行数:29,代码来源:loginController.php

示例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;
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:33,代码来源:auth.class.php

示例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();
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:32,代码来源:Visitor.php

示例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) {
         });
     }
 }
开发者ID:takawasitobi,项目名称:pembit,代码行数:33,代码来源:session.php


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