This question already has an answer here:
I am trying to figure something out. I am using CodeIgniter and I am storing some information in the session so I can access it everywhere. I need to check if a variable has been already set, but the code I am using is not working (controller break apart)
This is how I store the data in the session:
$this->session->set_userdata('myvalue', 'x');
And this is how I am trying to check if the variable has been declared:
if (isset($this->session->userdata('myvalue'))) //doesn't work
In advance thanks for reading and replying ;)
BTW: I need this function, because if I know that the var hasn't been declared it means the session has expired and has been destroyed. So I want to forward the user to a view where I tell him he has been inactive for too long and has been automatically logged out, etc.
</div>