Jump to content

Session array


allex01

Recommended Posts

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

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  ;D

 

<?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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.