Re: PHPSESSID in links

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kevin Murphy wrote:
I've got a site (password protected, sorry) where I have this in the top of my template:

    session_start();
    $iSessionId = session_id();
    $iSessionName = session_name();

Then I have a bunch of links like this in the site:

echo "<a href=\"/departments/\">Departments</a>";

The first time, and only the first time you load the page, that link is transformed in the HTML output to be this:

<a href="/departments/?PHPSESSID=4aec641b497131493b1c4bf489def723">Departments</a>

But if I reload the page, or go to any other page, I will get this:

<a href="/departments/">Departments</a>

which is what I want. Obviously I could do something where if it detects the PHPSESSID in the URL, it forces the page to reload, but I was thinking that there would be another way to do this without adding another page load into the mix. Is there?

These are caused by the php.ini setting session.use_trans_sid being on. This setting allows sessions to work when cookies are disabled.

http://php.net/ref.session#ini.session.use-trans-sid

I'm not sure why you have such a problem with it. Why is it important that the URL does not contain the session ID?

Anyway, the way to "fix" it is to disable that php.ini setting.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux