Welcome Guest, Not a member yet? Register   Sign In
Storing Array Data in CI Session
#6

[eluser]Natebot[/eluser]
Quote:I can do:
Code:
// after login
$permissions = array(); // large array from role based tables in DB.
$this->session->set_userdata('perm_bil', $permissions['bil']);
$this->session->set_userdata('perm_shp', $permissions['shp']));

// in secured controller
$perm_shp = $this->session->userdata('perm_shp');
echo $perm_shp['add'];

Do you see any issues in doing it this way?

the only issue that comes to mind is that $perm_shp is at risk of being overwritten accidentally. It's not like the session objects userdata parameter is protected but you could do that if you extend the class with PHP5. Likewise you could extend the Controller class to hold the data in a protected parameter.


Messages In This Thread
Storing Array Data in CI Session - by El Forum - 04-24-2009, 10:30 AM
Storing Array Data in CI Session - by El Forum - 04-24-2009, 10:53 AM
Storing Array Data in CI Session - by El Forum - 04-24-2009, 11:16 AM
Storing Array Data in CI Session - by El Forum - 04-24-2009, 05:01 PM
Storing Array Data in CI Session - by El Forum - 04-25-2009, 12:34 AM
Storing Array Data in CI Session - by El Forum - 04-25-2009, 12:40 AM
Storing Array Data in CI Session - by El Forum - 04-25-2009, 04:10 AM
Storing Array Data in CI Session - by El Forum - 04-25-2009, 07:23 PM
Storing Array Data in CI Session - by El Forum - 04-26-2009, 11:29 PM
Storing Array Data in CI Session - by El Forum - 04-27-2009, 11:00 AM
Storing Array Data in CI Session - by El Forum - 02-26-2010, 08:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB