Welcome Guest, Not a member yet? Register   Sign In
Use CI Sessions outside of CI
#1

[eluser]Matthew Lanham[/eluser]
Hey All,

I have been developing my whole App in CI, but i'm trying to do some stuff with XML and i need the files to be external, but i have some security stuff in a CI session, is there any way of accessing the session library that CI uses to keep the session active...?
#2

[eluser]Randy Casburn[/eluser]
[quote author="swanweb" date="1217127596"]
...i'm trying to do some stuff with XML...

...but i have some security stuff in a CI session...

[/quote]

OK...you don't want your user to authenticate again...so you need you session data from CI...but the first phrase is just not very helpful my friend. Any details at all?

Randy
#3

[eluser]Randy Casburn[/eluser]
What session persistance method are you using? Are session stored in a DB? If so, you likely don't need CI at all, you just need access to the right query and perhaps the decryption method. If stored in the cookie (hopefully not since this seems to be user auth stuff) then you just need the cookie, you still don't need CI.

With more information about what you've developed, we'll be able to help.

Randy
#4

[eluser]Matthew Lanham[/eluser]
Currently the system is using a COOKIE, we may change to DB before we go live, but COOKIE is how its stored at the moment, im looking to transfer a code, its like a user id, but this code is only a minor part of the authentication, however each row in my database is linked to the users company via this code....

So i have this in my CI session, i just need to know how i can get this out on a normal PHP page

Any help would be great!
#5

[eluser]Matthew Lanham[/eluser]
I've managed to figure it out, i was thinking it was something it wasn't Smile

You first need to unserialize the data stored in the session:

$sess = unserialize($_COOKIE['ci_session']);

Then use it like a traditional array $sess['data_key'];
#6

[eluser]Randy Casburn[/eluser]
Great. Glad you got it all figured.

Randy
#7

[eluser]Grahack[/eluser]
If you want to use CI in external code, you could try Dip into CI.




Theme © iAndrew 2016 - Forum software by © MyBB