Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8079447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:06:12+00:00 2026-06-05T16:06:12+00:00

My CI sessions are stored in my database. I have a native PHP script

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:06:14+00:00Added an answer on June 5, 2026 at 4:06 pm

    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()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using CodeIgniter with CodeIgniter sessions that are stored in a MySQL database. I
There is an array of user states stored in the session. This works: <?php
I have roughly 100,000 Objects that I want to insert into the database. I
Using PHP.. I have a small app that I built that currently uses a
Having followed a tutorial online, I have a sessions controller that looks like: class
I've written a simple entry form that compiles information onto a database, and I'm
I am using codeigniter's session class to handle my PHP sessions. One of the
Our client's database admins have requested that we don't use temp tables within our
I have multiple sessions working in my database at the same time. (regular DB
I'm using sessions in Django to store login user information as well as some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.