sessions and SID

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
jaybee
Forum Newbie
Posts: 12
Joined: Tue May 14, 2002 3:58 pm
Location: brighton, uk

sessions and SID

Post by jaybee »

I don't know anything about sessions in php - can you tell me why this:

Code: Select all

<A HREF="count.php?<?=SID?>">click here</A>
outputs the session id twice, giving me:

Code: Select all

<A HREF="count.php?PHPSESSID=8d84fa7945203ceb286c599f8145bce3&PHPSESSID=8d84fa7945203ceb286c599f8145bce3">click here</A>
.........? Although it still seems to work OK, it's puzzling me.
User avatar
fatal
Forum Contributor
Posts: 118
Joined: Sat Apr 20, 2002 10:47 am
Location: East Coast

Post by fatal »

have you read up on sessions at all?

Because when you start a session with session_start(), the when you echo out the session ID you will get something like you got.

Use $PHPSESSID or
$ID = session_id();
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

May be your php has been compiled with --enable-trans-sid option. That will append the SID automatically to relative links. This eyplains why the parameter PHPSESSID is sent twice. <?=SID?> sends it and the auto-append, too
User avatar
jaybee
Forum Newbie
Posts: 12
Joined: Tue May 14, 2002 3:58 pm
Location: brighton, uk

Post by jaybee »

You're right volka, thanks for that,
Post Reply