Welcome Guest, Not a member yet? Register   Sign In
Check session exit ?
#1

[eluser]Hamed[/eluser]
Hello,
How can I check session exit for example I use isset() in normal php now I want to check $this->session->userdata('uid') exit or set.
#2

[eluser]Oscar Dias[/eluser]
When you exit the session you can unset the userdata
Code:
$this->session->unset_userdata('uid');
Then when you check $this->session->userdata('uid') it will return false. If it returns the uid than the user did not exit the session.
#3

[eluser]Hamed[/eluser]
Then when there is no session for uid $this->session->userdata(‘uid’) return false//?
#4

[eluser]dnc[/eluser]
Just Like Oscar Dias said when you unset the session it should return false. If you want to make sure than just like was said in PHP:

Code:
if(!isset($this->session->userdata('uid'))) {

//do whatever you need to do. The session['uid'] is not set

}


By the way your still working with "normal" PHP. Just got an awesome framework to kickstat your work with.

#5

[eluser]dnc[/eluser]
Actually I told you wrong on this. You will have to check it like:


Code:
if(!$this->session->userdata('uid'))) {

//do whatever you need to do. The session['uid'] is not set

}




Theme © iAndrew 2016 - Forum software by © MyBB