CodeIgniter Session

codeigniter, php

Solution

Depending if you auto-load the session library or not, we will need to include:

$this->load->library('session'); 

Then you should be able to use:

$session_id = $this->session->userdata('SessionID');

Does this get you what you need?

Problem

I am trying to use a third party script and extract the logged in users userid. I am aware the CodeIgniter uses some sort of encrypted sessions. Can you please suggest how to get the userid. A simple $_SESSION does not seem to work. I am basically running a separate script and i just want the session details i.e. the userid. But I do not want to modify this script as MVC model. I want to modify it as minimal as possible. Sorry I am very new to CodeIgniter. Thank you for your time.

Original source