Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

enabling trans_sid

Status
Not open for further replies.

bastienk

Programmer
Joined
Mar 3, 2004
Messages
326
Location
CA
I am working on a site where sessions are doing weird things - like dropping between pages. I want to see if, by enabling trans_sid, I can propogate the session id in the url and keep the sessions alive....

Having trouble getting the ini_set statement to work...



Code:
//index.php 
session_start();
ini_set(use_trans_sid,1);


What is the correct way to do this? Should I merely add the id to the links between the pages by appending it to the URL?

TIA


Bastien

Cat, the other other white meat
 
The PHP online manual page on session handling states that session.use_trans_sid is changeable as "PHP_INI_SYSTEM | PHP_INI_PERDIR". This page interprets the changeability options.

"PHP_INI_SYSTEM | PHP_INI_PERDIR" means that session.use_trans_sid can be set in php.ini, httpd.conf, or a .htaccess file.

This makes sense -- session.use_trans_sid must be set before your script ever runs so that PHP knows how to get the session ID so that it can initialize $_SESSION when you invoke session_start().

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I get ya. Thanks.

This is still the same issue from yesterday where I am having problems keeping the session alive while moving between pages...

I learned that header("location:..") redirects can cause interference with the session vars staying alive. So I moved to using a js redirect to other pages and that seems to be working...


Bastien

Cat, the other other white meat
 
That depends on your web server.

If you're using IIS, when you use the "Location:" header, IIS does not send cookies. If the session cookie has not already been sent to the client, the session fails.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Linux server...and session are started at the opening of the index.php page..

each page also has session_start before any code...

Actually in tests, it works fine on iis locally and on iis in a true server environment...

How would client browser setting affect this? I thought the session id would be propogated in the url if no session cookies are allowed by client browser...


Bastien

Cat, the other other white meat
 
The trouble is, there is no intrinsic way for PHP to know whether the browser is accepting cookies.

You can, in your own PHP code, set a cookie, see if it is returned, then react accordingly.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
In conclusion, after a week of really hard work determining why the damned sessions are messedup, it turned out to be what I thought it was and the client and ISP won't believe...

The ISP messed up the ini page's sessions settings




Bastien

Cat, the other other white meat
 
Well, I had asked them to, but it was insited that it was my code (though it worked fine in local test environment (w2k, iis). I had to fight to get phpinfo info to compare to...

oh well, lol....




Bastien

Cat, the other other white meat
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top