hinch
12-11-2008, 04:27 PM
I've encountered a little problem and I'm not sure why basically.
The site I'm working on has 3 login area's .
In the case of each login area I store a userID and various other information in a session.
On Member Login I store this:
$_SESSION['userid'] = $userdetails[0].",".$_POST['myusername'];
On Company Login I store this:
$_SESSION['corpid'] = $actual_id[0];
And on Admin Login I store this
$_SESSION['adminid'] = $userdetails[0].",".$userdetails[3].",".$userdetails[4];
Now here's where the fun begins.
On the userid the front end works perfectly on both the linux server and the windows dev machine when i do $_SESSION['userid'][0] or $_SESSION['userid'][1]
The corpid session always works fine since its only a single int stored.
The admin session is where the fun begins.
On windows doing a print_r of the session returns this
1,Administrator,emailaddress
perfect just what I want. on the linux server a print_r returns this though
Array ( [0] => Array )
So me thinking that perhaps I just need to explode out the string stored.
$adminid=explode(",",$_SESSION['adminid']);
Now print_r ($adminid); on windows returns this
Array ( [0] => 1 [1] => Administrator [2] => emailaddress )
again perfect just what I want but on linux it returns this
Array ( [0] => Array )
Am I being massively stupid with array handling here or am I missing something completely?
I'm a little confused since it works on the user front end fine and only appears to cause a problem in the admin area with the adminid session.
The site I'm working on has 3 login area's .
In the case of each login area I store a userID and various other information in a session.
On Member Login I store this:
$_SESSION['userid'] = $userdetails[0].",".$_POST['myusername'];
On Company Login I store this:
$_SESSION['corpid'] = $actual_id[0];
And on Admin Login I store this
$_SESSION['adminid'] = $userdetails[0].",".$userdetails[3].",".$userdetails[4];
Now here's where the fun begins.
On the userid the front end works perfectly on both the linux server and the windows dev machine when i do $_SESSION['userid'][0] or $_SESSION['userid'][1]
The corpid session always works fine since its only a single int stored.
The admin session is where the fun begins.
On windows doing a print_r of the session returns this
1,Administrator,emailaddress
perfect just what I want. on the linux server a print_r returns this though
Array ( [0] => Array )
So me thinking that perhaps I just need to explode out the string stored.
$adminid=explode(",",$_SESSION['adminid']);
Now print_r ($adminid); on windows returns this
Array ( [0] => 1 [1] => Administrator [2] => emailaddress )
again perfect just what I want but on linux it returns this
Array ( [0] => Array )
Am I being massively stupid with array handling here or am I missing something completely?
I'm a little confused since it works on the user front end fine and only appears to cause a problem in the admin area with the adminid session.