Forum Moderators: coopster

Message Too Old, No Replies

Session jumps to URL passing

         

thesheep

12:02 pm on Jun 24, 2004 (gmt 0)

10+ Year Member



I begin each page with session_start();
I set session variables like this:

$_SESSION['user_id'] = 'MyID';

then checking if this is set on the next page.

However the second page I visit on the site sometimes has the PHPSESSID appended to the URL, sometimes not.

My hosting company has session.use_trans_sid set to ON. So do I need to explicitly disable it to use cookies?

(2) The URL of the pages changes to having an extra '/' when I redirect by sending a HTTP header. I do

header("Location: ["...] . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/" . $filename);

www.example.co.uk//login.php

I'm wondering if it has something to do with magic quotes being On (they are on on this system). Or perhaps because there is no extra directory - does the dirname() function just return a slash?

[edited by: jatar_k at 5:36 pm (utc) on June 24, 2004]
[edit reason] no personal urls thanks [/edit]

thesheep

1:11 pm on Jun 24, 2004 (gmt 0)

10+ Year Member



OK so I see that dirname($_SERVER['PHP_SELF']) produces a slash / at the start of the directory returned. So if I'm in the web root I don't need to add a . "/" explicitly.

ergophobe

3:00 pm on Jun 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



So you have it all figured out?

And no, you do not have to turn transparent sessions off to enable cookies, but it is possible to force the use of cookies (in other words, cookies blocked, no sessions).

Tom

thesheep

3:45 pm on Jun 24, 2004 (gmt 0)

10+ Year Member



Hi Tom,

I haven't worked out why it jumps to sending via URL only sometimes, and only once per visit, then doesn't do it again. Probably something stupid I'm missing.

ergophobe

4:07 pm on Jun 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don't know. You can try to disable transparent sessions and see what happens.

Tom