Forum Moderators: coopster

Message Too Old, No Replies

Why is php appending session ID's to my links?

For example...

         

HughMungus

11:32 pm on Nov 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have some links in my menu. All the links that should look like this:

something.php?somevariable=somevalue

are showing up as:

something.php?somevariable=somevalue&PHPSESSID=dc9539a9e168c707b8f3d6ed4671f2dc

I've justt started messing with php sessions and I have "session_start()" at the top of this particular page but is it normal for a session ID to be tacked on like that?

volatilegx

11:59 pm on Nov 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I have "session_start()" at the top of this particular page but is it normal for a session ID to be tacked on like that?

Yes.

coopster

12:16 am on Nov 18, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



This recent thread will give you an idea on how it works (see specifically the links in the thread).

Session and Cookie logic [webmasterworld.com]

HughMungus

12:53 am on Nov 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oops. Edit: Is there a way to not have the session ID hanging out on a link like that?

coopster

12:58 am on Nov 18, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



The link in the thread mentioned has the answer. Have a look at PHP's Session Handling Functions [php.net] and pay particular attention to the configuration directives:
session.use_only_cookies 
session.use_trans_sid

HughMungus

3:39 pm on Nov 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Isn't using cookies kind of hit or miss due to cookie blocking software, etc?

coopster

12:59 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



That's a decision you'll have to make. You will be able to tell if the user has accepted cookies or not. If the user doesn't allow cookies, do you allow them acces to the secured area?

tomda

1:14 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



HughMungus : But it should only do it once, isn't it? Once, the user browse a second page, the session_id value should normally disappear?