CodeIgniter - how to query DB session?

My CI sessions are stored in my database.

I have a native PHP script outside of CodeIgniter that needs some information that's in userdata. Is there a way for my to query the CI session table and figure out what the current user's session is? I think CI checks the user IP and the "first 120 characters of the browser data string." Those 2 pieced of data are available to that outside script, right? Can I query for those 2 fields and get an accurate result? Or is CI somehow aware of what the session_id is?

Alternatively, I thought I could could set a native session variable from CI containing the information I needed and try to access it in the outside PHP script. It didn't work.

I'm open to suggestions.


I used this code to integrate comet chat(an external app) with my CI user system: you might need to modify it but you can get the gyst:

$decoded_ci_session = @unserialize(@stripslashes($_COOKIE['ci_session']));

$sql = "SELECT user_data FROM ".TABLE_PREFIX."sessions WHERE session_id = '".$decoded_ci_session['session_id']."'";

$query = mysql_query($sql);
$row = mysql_fetch_array($query);
$decoded_ci_session = @unserialize(@stripslashes($row[0]));

at the end $decoded_ci_session should contain all the userdata normally in $this->session->userdata()

Need Your Help

how to redirect to default page on logout

i have a masterpage which contains loginstatus control

Pick a video from iPhone photo library

ios iphone objective-c xcode5 uiimagepickercontroller

I am trying to pick a video from iPhone photo library using UIImagePickerController so that i can upload it to the server.