Welcome Guest, Not a member yet? Register   Sign In
Importance of calling exit after redirect ?? session redirect problem
#1

[eluser]coldfire82[/eluser]
Hi,

I am using exit after doing a redirect() eg.
Code:
//if login fails
$this->session->sess_destroy();
redirect('login');
exit;

I have started using it after I stumbled on using sessions. Apparently the session values were not getting updated after I update them and do redirect e.g.

Code:
// assign some value to session variable 'code'
$this->session->set_userdata('code', $code_val);
redirect('home');

On /home, the session variable 'code' had the old value.

I have tried many solutions but none seem to work and the sessions started giving this problem out of no where. Just started in the middle when i was not even close to working with sessions and login functionality!!!

Anyhow, many people (on stackoverflow) recommended using exit() after redirect. I just want to know if that is one of the possible solutions. Before using exit(), the sessions were also working fine but now they dont. :?

--





Theme © iAndrew 2016 - Forum software by © MyBB