Welcome Guest, Not a member yet? Register   Sign In
help with boolean
#2

[eluser]bretticus[/eluser]
[quote author="KrizzAngel" date="1264151612"]
Code:
function checker()
    {
        $is_logged_in = $this->session->userdata('is_logged_in');
        if(!isset($is_logged_in) || $is_logged_in != true)
        {
            return true;
        }
        
    }
[/quote]

Code:
$this->session->userdata('is_logged_in')

...according to the manual this call will either return the value you set in it (boolean perhaps?) or FALSE if that session key (is_logged_in) is not found.

isset() simply checks to see if the variable is set. Since you set it before your if statement,
Code:
!isset($is_logged_in)
will never be true because
Code:
isset($is_logged_in)
is always true.

In fact, as long as you are setting boolean values to the session item, you can probably make this function a one-liner:

Code:
function checker(){
     return $this->session->userdata('is_logged_in');
}


Messages In This Thread
help with boolean - by El Forum - 01-21-2010, 09:13 PM
help with boolean - by El Forum - 01-21-2010, 11:04 PM
help with boolean - by El Forum - 01-22-2010, 02:01 AM
help with boolean - by El Forum - 01-22-2010, 03:32 AM
help with boolean - by El Forum - 01-22-2010, 03:51 AM
help with boolean - by El Forum - 01-22-2010, 05:30 AM
help with boolean - by El Forum - 01-22-2010, 07:04 AM
help with boolean - by El Forum - 01-22-2010, 07:14 AM
help with boolean - by El Forum - 01-22-2010, 10:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB