allex01 Posted February 20, 2008 Share Posted February 20, 2008 How can i retrieve the password value from this session array. I tried something like $_SESSION['fc_users_cache']['password'] but can't seem to get it. Any help would be greatly appreciated. I simply did a print_r($_SESSION); to get the following Array ( [user] => Array ( [user_id] => 1 [user_name] => webmaster [time_zone] => 0 ) => [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 => [email protected] [referrer_id] => 0 [first_name] => admin [last_name] => admin ) ) Link to comment https://forums.phpfreaks.com/topic/92048-session-array/ Share on other sites More sharing options...
mainewoods Posted February 20, 2008 Share Posted February 20, 2008 $_SESSION['fc_users_cache'][1]['password'] --you need that '[1]' in there Link to comment https://forums.phpfreaks.com/topic/92048-session-array/#findComment-471396 Share on other sites More sharing options...
allex01 Posted February 20, 2008 Author Share Posted February 20, 2008 Yes i tried that and it didn't work. I can easily get the user_name by doing $_SESSION['user']['user_name'] but i'm not able to get the password using the following I tried $_SESSION['fc_users_cache']['password'] or $_SESSION['fc_users_cache'][1]['password'] or $_SESSION['fc_users_cache']['1']['password'] Link to comment https://forums.phpfreaks.com/topic/92048-session-array/#findComment-471401 Share on other sites More sharing options...
allex01 Posted February 20, 2008 Author Share Posted February 20, 2008 Anyone?? Link to comment https://forums.phpfreaks.com/topic/92048-session-array/#findComment-471444 Share on other sites More sharing options...
cowfish Posted February 20, 2008 Share Posted February 20, 2008 deleted post. Link to comment https://forums.phpfreaks.com/topic/92048-session-array/#findComment-471453 Share on other sites More sharing options...
allex01 Posted February 20, 2008 Author Share Posted February 20, 2008 It's a typo and has nothing to do with the questions above. Even if it was typo it's irrelavent. Link to comment https://forums.phpfreaks.com/topic/92048-session-array/#findComment-471454 Share on other sites More sharing options...
cowfish Posted February 20, 2008 Share Posted February 20, 2008 Yeah you're right it's not relevant. Link to comment https://forums.phpfreaks.com/topic/92048-session-array/#findComment-471461 Share on other sites More sharing options...
cowfish Posted February 20, 2008 Share Posted February 20, 2008 I rebuilt your array and tested it. It seems like it is working :-\ You can test the following code if you like. Did you forget to put in an echo before $_SESSION['fc_users_cache']['password'] ? I'm asking that because I do it quite often <?php $myArray = array ( "user" => array ( "user_id" => 1, "user_name" => "webmaster", "time_zone" => 0, ), "url" =>NULL, "admin" => array("is_logged_in" => 1), "pstart" => 0, "vstart" => 0, "astart" => 0, "mstart" => 0, "fastart" => 0, "fc_users_cache" => array ( 1 => array ( "user_id" => 1, "user_name" => "admin", "password" => "adminpass", "email" => "[email protected]", "referrer_id" => 0, "first_name" => "admin", "last_name" => "admin", ) ) ); echo $myArray['fc_users_cache']['1']['password']; echo "<br />"; echo $myArray['fc_users_cache'][1]['password']; ?> Link to comment https://forums.phpfreaks.com/topic/92048-session-array/#findComment-471467 Share on other sites More sharing options...
rameshfaj Posted February 20, 2008 Share Posted February 20, 2008 Can we know how did u first insert the data into session?The retrieval may vary in that manner too. Link to comment https://forums.phpfreaks.com/topic/92048-session-array/#findComment-471484 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.