Welcome Guest, Not a member yet? Register   Sign In
Newbie: My session object does not exist
#1

[eluser]sfurrh[/eluser]
I have this in my autoload.php:
$autoload['libraries'] = array('database','session');

I have this method in a controller that is defined in the hooks.php as a pre_controller:
public function redirectToLogin(){
$this->load->helper('url');
$this->session->set_flashdata("currenturl",current_url());
$this->session->keep_flashdata("currenturl");
log_message('debug',"currenturl:".$this->session->flashdata("currenturl"));
$url=site_url()."/login";
redirect($url);
}

My problem is that when I get to the index() method of the login controller the session does not exist. I have tried loading the library in several places and I can see in the log that the session library is already initialized. Here is my login code:
function index(){
$this->load->library("session");
log_message("debug","session=".$this->session);
$data["currenturl"]=$this->session->flashdata("currenturl");
$this->load->view('login');
}

What am I doing wrong?




Theme © iAndrew 2016 - Forum software by © MyBB