Welcome Guest, Not a member yet? Register   Sign In
session problem , i want check session active and redirect to login page for all page
#3

I did it but it does not work,
I wanted to block page access without an active session; when I close the tab and I retype the link he must have already killed the session to open the login page





<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class MY_Controller extends CI_Controller {

public function __construct() {
parent::__construct();

//For example I have set logged_in = true in authentication on success
//Checking whether userdata logged_in not set ... if true redirecting to login screen
if (!isset($this->session->userdata['logged_in'])) {
redirect(site_url('login'));
}

}






}
Reply


Messages In This Thread
RE: session problem , i want check session active and redirect to login page for all page - by said2019 - 11-06-2019, 11:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB