Welcome Guest, Not a member yet? Register   Sign In
Problems with sessions
#1

[eluser]old_guy[/eluser]
I'm having a problem getting the sessions function to work properly. I have a login function that checks for login info and then sets a session value (I'm storing session info in a database) as follows:

function login()
{
$this->load->model('check_login');
$data = $this->check_login->ck_name();
$id = $data;
if ($id > 0)
{
$newdata = array('status' => 'ok');
$this->session->set_userdata($newdata);
$this->home();
}else{
$this->login_error();
}
}

When I run the above I get this error message "Message: Undefined property: Start::$session" which I assumed was because I didn't load the session library.

But, when I load the sessions library ($this->session->library('session') prior to the set_userupdate I get the following error "Message: Cannot modify header information - headers already sent by..."

Could use some help understanding this....thanks!
#2

[eluser]Spiked[/eluser]
“Message: Cannot modify header information - headers already sent by...” is mainly caused by whitespaces after the last closing <?php tag. Check your documents for spaces after the last tags, or completely remove the closing tags.




Theme © iAndrew 2016 - Forum software by © MyBB