Reputation: 873
I will be short in my question.
In my codeigniter setup I use database session. in this session I have a variable admin_site_id which i get via
$this->session->userdata('admin_site_id');
What would be the best way to get the same thing in non CI php script?
I have a file manager of fckeditor, which I want to integrate but the pics should be uploaded in different folders , depending on the website administrator is editing right now...
Upvotes: 2
Views: 1599
Reputation: 1304
I did something similar on a CI project recently. I ended up using the Native Session Library (http://codeigniter.com/wiki/Native_session/) that uses native PHP sessions.
So I was able to set a session variable that was accessible in CI - using the typical CI session syntax, but was then able to access that same session using a non-CI php script.
My project for this isn't live yet, so I can't speak to any potential production issues that might come up, but others seem to be using it without problems.
Upvotes: 0
Reputation: 2276
By default, CI stores session data in a cookie called ci_sessions, you can access it through: $_COOKIE['ci_session'];
Depending on if you magic_quotes turned on, encryption, or storing session data in the database you may have to remove slashes, unserialize the data, and run a SQL query to grab the data using the cookie hash.
You can read more on how to this here:
http://renownedmedia.com/blog/accessing-codeigniter-session-data-using-external-scripts
Upvotes: 1