Page 1 of 1
'Blank' Sessions
Posted: Fri Jan 07, 2005 4:59 am
by Klyve1
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
Posted: Fri Jan 07, 2005 5:00 am
by Chris Corbyn
I'll have a look at your code if you send the relevant bits

Posted: Fri Jan 07, 2005 5:32 am
by Klyve1
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.
Posted: Fri Jan 07, 2005 5:50 am
by Chris Corbyn
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.

Posted: Fri Jan 07, 2005 6:42 am
by Klyve1
I'm not using id's as part of the url string, (and don't want to either) does this make any difference
Posted: Fri Jan 07, 2005 7:13 am
by Klyve1
Thanks for your help, I've now fixed the issue
I've added the following:
Code: Select all
<?php
if (!$PHPSESSID) { $PHPSESSID = session_id();}
?>