Page 1 of 1

Session Array

Posted: Wed Feb 20, 2008 2:52 am
by allen01
How can i retrieve the password value from this session array. I tried something like $_SESSION['fc_users_cache'][1]['password'] but it's not working. I can easily get the user_name by doing $_SESSION['user']['user_name'] but i'm not able to get the password. Any help would be greatly appreciated.
I did a print_r($_SESSION); to get the following

***** PLEASE USE THE

Code: Select all

TAG WHEN POSTING *****[/color]
 

Code: Select all

Array
(
    [user] => Array
        (
            [user_id] => 1
            [user_name] => admin
            [time_zone] => 0
        )
 
    [url] =>
    [admin] => Array
        (
            [is_logged_in] => 1
        )
 
    [pstart] => 0
    [vstart] => 0
    [astart] => 0
    [mstart] => 0
    [fstart] => 0
    [fc_users_cache] => Array
        (
            [1] => Array
                (
                    [user_id] => 1
                    [user_name] => admin
                    [password] => adminpass
                    [referrer_id] => 0
                    [first_name] => admin
                    [last_name] => admin
                )
 
        )

Re: Session Array

Posted: Wed Feb 20, 2008 3:07 am
by Christopher
$_SESSION['fc_users_cache'][1]['password'] should work, but there is something strange going on on the next line at ['email']???

Re: Session Array

Posted: Wed Feb 20, 2008 3:09 am
by allen01
The email part was a typo. I edited the thread and removed it. I did $_SESSION['fc_users_cache'][1]['password'] but for some reason it's just not pulling up the value.

Re: Session Array

Posted: Wed Feb 20, 2008 3:11 am
by Benjamin
Post your code, it's in the array so the code pulling it out must have a glitch.

Re: Session Array

Posted: Wed Feb 20, 2008 3:13 am
by allen01
The code is simple. All i want to do is pull the value.

session_start();
$pass = $_SESSION['fc_users_cache'][1]['password'];
echo $pass;

Re: Session Array

Posted: Wed Feb 20, 2008 3:15 am
by Benjamin
Post the actual code.

Re: Session Array

Posted: Wed Feb 20, 2008 3:16 am
by Christopher
Is it possible that it is: $_SESSION['fc_users_cache']['1']['password'] which is actually $_SESSION['fc_users_cache'][0]['password'] ???