CodeIgniter Forums
possible to load another session data in array? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: possible to load another session data in array? (/showthread.php?tid=46857)



possible to load another session data in array? - El Forum - 11-17-2011

[eluser]dadamssg[/eluser]
I changed my sessions to be stored in a 'ci_sessions' db table. Is it possible to get a session id then use codeigniter's system session library to pull the data from that session into an array?

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Session_testing extends CI_Controller {

public function __construct()
   {
     parent::__construct();
  $this->load->helper(array('form', 'url', 'html','string','content'));
  $this->load->library(array('session','form_validation','encrypt'));
  $this->load->database();
  $this->load->model(array('ci_session_model'));
  
}

public function index()
{
$current_session_data = $this->session->all_userdata();

$another_session_id = "27583395acc105ef32282728121bef38";

$another_session = $this->_get_session_data($another_session_id) ;                  
}

function _get_session_data($session_id)
{
//code to return all of another session's data in array format
}
}
?>