views:

240

answers:

2

I'm trying to get php to automatically pass the session ID via url, even if the browser accepts cookies.

I know url session id are normally considered a security risk, but I have a very specific application in mind which requires several separate users to be able to log in to the same php session, despite what cookie settings their browsers have. Sharing the url is my aim here, rather than a threat.

There will be several "groups" of users, each group should have a unique shared session, so simply applying a fixed session id in the code won't work. I want the "owner" of the group to be able to initiate the session, get a unique id, then pass this on to all the other users, via a url.

As it's an existing application, I can't make modifications that will affect the normal session behaviour for other users - this is for users in a specific group of IPs - which is why i'm trying to modify the standard session handling.

I've tried using ini_set() to disable session.use_cookie, but that simply prevents the session from being remembered at all.

Any suggestions gratefully received.

A: 

Have you try enabling session.use_trans_sid ?

Delapouite
yup - and disabled session.use_cookie - but still the SID doesn't get passed. I even tried adding the SID to a link or two just to test (can't do that for the full app), but altho it's then passed in the url, the next page doesn't automatically pick it up and set the session id - my app logs me out as if no session exists
Hippyjim
Ok, so pass directly your $_GET ID into session_id() function
Delapouite
Thanks Delapouite - that was the bit I was missing. i was under the impression that using use_trans_id would have it automatically pick up the session id from the url. Having the code check for the ID in the $_GET and applying it if it's there did the trick.
Hippyjim
A: 

Set

session.use_cookies=0
session.use_trans_sid=1

via ini_set() or in the php.ini, .htaccess ...or where ever you can change the configuration settings.
see also:

VolkerK