destroy() public static method

deletes the session (= logs the user out)
public static destroy ( )
 public function logoutAction($key = 'user')
 {
     Session::remove($key);
     Session::destroy();
     Session::setFlash(__t('you_logout'));
     $this->redirect("/");
 }
Example #2
0
 public static function handleLogin()
 {
     Session::init();
     if ($_SESSION['user_logged_in'] == false) {
         Session::destroy();
     }
 }
Example #3
0
 /**
  * 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';
         }
     }
 }
 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;
     }
 }
Example #5
0
 function destroySession()
 {
     Session::init();
     Session::destroy();
     print_r($_SESSION);
     header("location: " . URL);
 }
 protected function runPage()
 {
     Session::destroy();
     global $cScriptPath;
     $this->mHeaders[] = "HTTP/1.1 303 See Other";
     $this->mHeaders[] = "Location: " . $cScriptPath;
 }
 protected function runPage()
 {
     Session::destroy();
     global $cWebPath;
     $this->mHeaders[] = "HTTP/1.1 303 See Other";
     $this->mHeaders[] = "Location: " . $cWebPath . "/management.php/Login";
 }
Example #8
0
 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');
 }
Example #9
0
 public function update($token_id)
 {
     if (isset($_SESSION['token_id'])) {
         Session::destroy($token_id);
         Session::destroy('token_id');
     }
 }
 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());
         //}
     }
 }
 function logout()
 {
     Session::init();
     Session::destroy();
     header('location:' . URL . 'admincp');
     exit;
 }
Example #12
0
 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();
     }
 }
Example #13
0
 /**
  * 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;
 }
Example #14
0
 /**
  * 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();
 }
Example #15
0
 /**
  * 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) {
         });
     }
 }
Example #16
0
 public static function logout()
 {
     $conexion = new MySQL(0);
     $query = "update usuario set logged = 0, date_logged = now(), session_id = '' where usuario = '" . $_SESSION['login'] . "';";
     $result1 = $conexion->consulta($query);
     $conexion->MySQLClose();
     Session::destroy();
 }
 public function cerrar()
 {
     $bitacora_inicio_cerrar = $this->_admin->bitacora_login_cerrar(Session::Get('id_usuario'));
     //Se destruyen todas las variables de sesión
     Session::destroy();
     //Se redirecciona a otra página
     $this->redireccionar('principal/principal');
 }
Example #18
0
 /**
  * The destroy handler, this is executed when a session is destroyed with session_destroy() and takes the session id as its only parameter.
  */
 public function testSessionDestroy()
 {
     // destroy the session
     Session::destroy($this->testSessionID);
     // assert the session is now empty
     $result = Session::read($this->testSessionID);
     $this->assertEmpty($result);
 }
Example #19
0
 public function out()
 {
     Session::destroy();
     $this->load->view('login', $vars = null);
     echo "cikis yapildi";
     print_r($_SESSION);
     exit;
 }
 public function actionLogout()
 {
     Session::destroy(USER_LOGIN);
     $newList = array();
     $newList = Career::getAllCareer();
     require_once ROOT . '/templates/index.php';
     return true;
 }
Example #21
0
 /**
  * Destroys session
  * @return true if session destroyed, false otherwise.
  */
 public function logout()
 {
     $session = new Session($this->sessionId);
     if ($session->sessionId > 0) {
         return $session->destroy();
     }
     return false;
 }
Example #22
0
function syn_logout()
{
    global $udb;
    $oDb = getDb();
    $Session = new Session($oDb);
    $Session->destroy($udb['uid']);
    select_yjl_db();
}
 public function index()
 {
     if (Session::get('logined')) {
         $user_id = Session::get('user_id');
         $model = new Session_Model();
         $model->delete("user_id = '{$user_id}'");
         Session::destroy();
     }
 }
Example #24
0
 /**
  * 
  */
 public static function checkLogin()
 {
     Session::init();
     if (Session::get('loggedIn') == false) {
         Session::destroy();
         header("location: index.php?controlle=user&action=login");
         exit;
     }
 }
Example #25
0
 public function execute()
 {
     $user = Loader::get_user();
     $user->get_module('secret_key')->unset_secret_key();
     Session::destroy(Session::get_sid());
     $user->reset(0);
     self::set_client_command('unset_secret_key', array());
     self::set_client_command('refresh', array('url' => 'self'));
 }
 /**
  * Admin authentication flow, check if user is logged in and has
  * account type of 7 (=admin), else logout the user, redirect to login page and hard-stop.
  */
 public static function checkAdminAuthentication()
 {
     // initialize the session
     Session::init();
     if (!Session::userIsLoggedIn() || Session::get("user_account_type") != 7) {
         Session::destroy();
         Redirect::to('login');
         exit;
     }
 }
Example #27
0
 public function __construct()
 {
     parent::__construct();
     // Oturum Kontrolü
     Session::init();
     if (Session::get("login") == false) {
         Session::destroy();
         header("Location: " . SITE_URL . "/admin/login");
     }
 }
Example #28
0
 function isloggin()
 {
     Session::init();
     $loggin = Session::get('loggin');
     if ($loggin == false) {
         Session::destroy();
         header('Location: login');
         exit;
     }
 }
Example #29
0
 function __construct()
 {
     parent::__construct();
     $logged = Session::get('loggedIn');
     if ($logged == false) {
         Session::destroy();
         header('location:../serials/login');
         exit;
     }
 }
Example #30
0
 function __construct()
 {
     parent::__construct();
     Session::init();
     $logged = Session::get(SESSION_KEY);
     if ($logged == false) {
         Session::destroy();
         header('location: ../login');
     }
 }