Wednesday, April 08, 2009

Session ID not getting propogated in the URL properly?

When you generate URLs yourself using the SID variable, it must come first in the URL parameter list.

Example:
If SID expands to "some_session=123" then this does NOT work:

somefile.php?var1=value&some_session=123

The SID must come first in the query string:

somefile.php?some_session=123&var1=value

If the SID does not come first in the query string then session_start() does not recognise the session variable in the URL and creates a NEW session instead of loading the old one.

No comments: