Jessica Posted September 9, 2007 Share Posted September 9, 2007 I want to be able to have users use a site with cookies disabled, but it needs sessions. So I have been going over all of the session info in the manual trying to figure out how I add the session ID to the url when cookies are disabled. This is what I have: <?php ini_set('session.use_trans_sid', '1'); session_start(); print session_id(); ?> It is my understanding that now when I click a link, the session id should be added to the URL. However, that does not happen, and the session_id is changed. Also, if I refresh the page, a new session starts, with a new ID. None of my session data is being saved. For example if I have this: <?php if(isset($_SESSION['test'])){ print $_SESSION['test']; }else{ $_SESSION['test'] = 'test'; } ?> The first time it should show nothing, and the second time (refresh) it should show 'test'. It always shows nothing. Can anyone help me figure out how to accomplish this? I don't want to force users to enable cookies, but I don't want the session id in the URL unless it has to be. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 10, 2007 Author Share Posted September 10, 2007 bump Quote Link to comment Share on other sites More sharing options...
sayedsohail Posted September 10, 2007 Share Posted September 10, 2007 superguru jesirose, in my opinion, if you are using any set of config.php file to store the server path, i think this is where the problem is. i.e, $config_basedir = "http://127.0.0.1" or $config_basedir="http://localhost/xyz". apologize if i am wrong. Hope this helps. regards, Quote Link to comment Share on other sites More sharing options...
d22552000 Posted September 10, 2007 Share Posted September 10, 2007 hmm if you want it to be conditional tyr to set a cookie and read it imedietly, if it is not set or cant be retrieved assume that the browser wont accept it or thye have it disable, and then start passing the buck (sessionid) Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 10, 2007 Author Share Posted September 10, 2007 That would require having every header(), every link, etc have a variable on the end of it for in case the cookie doesn't set. I thought that was the point of trans_sid, so it does it FOR you. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted September 10, 2007 Share Posted September 10, 2007 Just curious if you noticed this in the documentation and made sure your PHP was configured correctly: PHP is capable of transforming links transparently. Unless you are using PHP 4.2.0 or later, you need to enable it manually when building PHP. Under Unix, pass --enable-trans-sid to configure. If this build option and the run-time option session.use_trans_sid are enabled, relative URIs will be changed to contain the session id automatically. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 10, 2007 Author Share Posted September 10, 2007 Yes, trans sid is configured and enabled. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted September 11, 2007 Share Posted September 11, 2007 And all of the URIs are relative? Sorry to ask such mundane questions; I just know how easy it is when frustrated by something to overlook the minor details (that are usually right in front of my face). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.