Page 1 of 1

PHP Session

Posted: Sun Mar 27, 2011 4:57 pm
by kerepuki
Hi everyone,

I have a small problem. I am developing applications which use sessions. Now these applications will live in a sub folders off the main domain ie. http://xxxxx.com/app1, http://xxxxx.com/app2, http://xxxxx.com/app3 etc.

Now when I start the session and retrieve information for the user against the session, I can get the same information in each of the apps. This is not what I want. I would like all cart info in http://xxxxx.com/app1 to be different to all cart info in http://xxxxx.com/app2.

I am setting the sessions like $_SESSION['app1']['cartID'], $_SESSION['app2']['cartID'] which I assume is fine however PHP is setting the same value because I imagine it is getting the cartID from http://xxxxx.com.

Please help, very important.

Thanks

Re: PHP Session

Posted: Mon Mar 28, 2011 2:59 am
by Mordred
session_set_cookie_params

Re: PHP Session

Posted: Tue Mar 29, 2011 4:58 pm
by kerepuki
Thanks for the reply however everything I have tried doesnt work. It all seems to be relating to app1.xxx.com, app2.xxx.com.

Can you please post a sample?

What I have tried are:
session_set_cookie_params(60*60*24*5, "/app1/", "xxx.com");
session_set_cookie_params(60*60*24*5, "/app1", "xxx.com");
session_set_cookie_params(60*60*24*5, "app1", "xxx.com");

Plus all other combinations using slash '/' in domain and path.

Thanks

Re: PHP Session

Posted: Wed Mar 30, 2011 4:46 am
by Mordred
How about this:
session_set_cookie_params(60*60*24*5, "/app1/", " .xxx.com");
(no time to test it, sorry)