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
Klyve1
Forum Newbie
Posts: 14 Joined: Wed Sep 18, 2002 4:27 am
Location: Hove, UK
Post
by Klyve1 » Fri Jan 07, 2005 4:59 am
I use sessions to identify customers as part of a shopping cart and have found on numerous occasions that no session id is picked up by $PHPSESSID.
Does anyone know why this is and how to fix it/work-around.
Thanks
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Fri Jan 07, 2005 5:00 am
I'll have a look at your code if you send the relevant bits
Klyve1
Forum Newbie
Posts: 14 Joined: Wed Sep 18, 2002 4:27 am
Location: Hove, UK
Post
by Klyve1 » Fri Jan 07, 2005 5:32 am
I'm using
session_start();
on all pages and $PHPSESSID to pick it up. This works 99.9% of the time but there's the odd one slipping through.
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Fri Jan 07, 2005 5:50 am
The correct way to do it is to use SID instead of $PHPSESSID (that's what goes in the URL by default). Try your code with cookies disabled in your browser and see if it works then let us know what happens.
Klyve1
Forum Newbie
Posts: 14 Joined: Wed Sep 18, 2002 4:27 am
Location: Hove, UK
Post
by Klyve1 » Fri Jan 07, 2005 6:42 am
I'm not using id's as part of the url string, (and don't want to either) does this make any difference
Klyve1
Forum Newbie
Posts: 14 Joined: Wed Sep 18, 2002 4:27 am
Location: Hove, UK
Post
by Klyve1 » Fri Jan 07, 2005 7:13 am
Thanks for your help, I've now fixed the issue
I've added the following:
Code: Select all
<?php
if (!$PHPSESSID) { $PHPSESSID = session_id();}
?>