i'm having problems with putting a session into an array and then accessing the values within that variable. the session is a multidimentional array as well. here is the code:
init.php
session_start();
$SPUDS_SESS = $_SESSION;
$_SESSION['member']['logged_in'] = true;
$SESS_ARRAY = set_userinfo_array();
function set_userinfo_array()
{
global $SPUDS_SESS;
/*$SPUDS_SESS['member'] = array (
'usr_lvl' => 10,
'usr_id' => 100,
'status' => 'banned'
);*/
$SPUDS_SESS['member']['usr_lvl'] = 10;
$SPUDS_SESS['member']['usr_id'] = 100;
$SPUDS_SESS['member']['status'] = 'banned';
$SPUDS_SESS['personal']['session_id'] = session_id();
$SPUDS_SESS['personal']['pwd'] = 'password';
$SPUDS_SESS['personal']['displayname'] = 'taters';
return $SPUDS_SESS;
}
index.php
include 'init.php';
if ($_SESSION['member']['logged_in'])
{
echo $SESS_ARRAY .'<br>';
echo $SESS_ARRAY[0] .'<br>';
echo $SESS_ARRAY[0][0] .'<br>';;
/*echo "Your member level is: <B>" . $SPUDS_SESS['member']['usr_lvl']. "</B><BR>";
echo "Your mysql user id is: <B>" . $SPUDS_SESS['member']['usr_id']. "</B><BR>";
echo "Your member status is: <B>" . $SPUDS_SESS['member']['status']. "</B><BR>";
echo "Your personal session id is: <B>" . $SPUDS_SESS['personal']['session_id']. "</B><BR>";
echo "Your personal pwd is: <B>" . $SPUDS_SESS['personal']['pwd']. "</B><BR>";
echo "Your displayname is: <B>" . $SPUDS_SESS['personal']['displayname']. "</B><BR>";
*/
}
i commented out some stuff because i wasn't returning in the set_user_info function initally and that's when it worked.
thanx for your help