Welcome Guest, Not a member yet? Register   Sign In
CI Sessions across Applications
#1

[eluser]whobutsb[/eluser]
Morning All, Question for ya.

I have two applications residing on the same server. With separate installs of CI.

http://test.com/application1
http://test.com/application2

What I would like to do is after a user fills out a form on application1 I would like to set a session with $this->session->set_userdata('userInfo', 'uesr info'); and then redirect them to application2, and automatically log them in to their profile based on what is in the session data by retrieving the info with $this->session->userdata('userInfo');

On my development server which is on a LAN this worked fine. But when I moved it into production on a different server on the DMZ application2 didn't register that the session->userdata was set.

What Am I missing? Is this possible?

Thanks for the help!
#2

[eluser]bigtony[/eluser]
Do the apps share the same database? If so you could use database sessions.
#3

[eluser]whobutsb[/eluser]
[quote author="bigtony" date="1255635302"]Do the apps share the same database? If so you could use database sessions.[/quote]

I could allow them to share the same database. Would I just need to turn on database caching in the config? Is there anything else besides that?

Thanks for the help?
#4

[eluser]bigtony[/eluser]
[quote author="whobutsb" date="1255635465"]I could allow them to share the same database. Would I just need to turn on database caching in the config? Is there anything else besides that?[/quote]
You might have a problem if your apps are completely different domains (i.e. app2 not being able to get access to cookies in app1), but your example suggests same for both.

Other than that, should be quick to setup and test (and db sessions is good practice in any case).
#5

[eluser]whobutsb[/eluser]
One more quick question. Does the ci_sessions have to reside in the default database? I don't think both applications have the same default database configured.
#6

[eluser]bigtony[/eluser]
[quote author="whobutsb" date="1255637175"]One more quick question. Does the ci_sessions have to reside in the default database? I don't think both applications have the same default database configured.[/quote]
You would normally put ci_sessions in the same database as all your other tables for the app. If you're using different db prefixes for the different apps it could be problematic...




Theme © iAndrew 2016 - Forum software by © MyBB