Welcome Guest, Not a member yet? Register   Sign In
How to retrieve $_SESSION variable out of CI
#1

Hello,

If fact it's simple, I use CI and in my admin I use the $_SESSION['auth'] to secure my admin.

In my admin I use ckeditor with fileman as image uploader.

I need to secure fileman by use my $_SESSION['auth'] variable, but there is no $_SESSION variable in security.php which is the file to secure fileman.

I can just retrieve the variable ci_session, this is a part of extract_var($GLOBALS).

'_COOKIE' => 
 array (
   'PHPSESSID' => 'bkf4lii33uvilgle2294ja3dn2',
   'ckCsrfToken' => 'RcUP2LBI2Ad74hDzLFj6d7kGtAMTKCUPKPASZdd3',
   'KCFINDER_showname' => 'on',
   'KCFINDER_showsize' => 'off',
   'KCFINDER_showtime' => 'off',
   'KCFINDER_order' => 'name',
   'KCFINDER_orderDesc' => 'off',
   'KCFINDER_view' => 'thumbs',
   'KCFINDER_displaySettings' => 'off',
   'ci_session' => 'm5hu8v0ffv3jmvfe1n6vj2bkhgoa5t32',
   'roxyview' => 'thumb',
   'roxyld' => '/fileman/upload',
 ),

my question is simple, is it possible to retrieve my $_SESSION['auth'] variable with my ci_session number ?
Reply
#2

If you have loaded CI's session class then the global variable $_SESSION will be available and populated with the key/value data that has been placed in the session.

Because CI uses custom drivers you must make the call
PHP Code:
$this->load->library('session'); 
for everything to work correctly.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB