[FX.php List] Eliminat the "?" with the SID option

DC dan.cynosure at dbmscan.com
Tue Nov 13 13:02:29 MST 2007


oops, small logic reversal error there...

$qmarkSID = (!empty(SID))?'?'.SID:'';


DC had written:
> sounds like you answered your own question.
> 
> SID has nothing in it when PHP "knows" that cookies are on.
> 
> can you just use empty() or isset() to test SID?
> 
> not tested:
> $qmarkSID = (!empty(SID))?'?':''.SID;
> $url=  "thenextpage.php'.$qmarkSID;
> 
> Jonathan Schwartz had written:
>> Hi Folks,
>>
>> After a year of ignoring this nagging issue, I've decided to fix it.
>>
>> I use the "SID" variable to ensure that my pages work when a user's 
>> cookies are turned off.  To do so, I ue the following code whenever I 
>> need to jump to another page:
>>
>> $url=  "thenextpage.php?'.SID;
>> header('Location:'.$url);
>>
>> This works great when cookies are turned off.  PHP automatically 
>> inserts the SESSID in the url.
>>
>> However, when cookies are turned on and the SESSID is not needed, I 
>> end up with a question mark at thr end of all my urls.  There are no 
>> problems other than the fact that it shouldn't be there.
>>
>> To eliminate the trailing questions mark, do I need to test for 
>> cookies and then change my two line scri pt above?  If so, is there a 
>> best way to test for cookies.  Right now, I just start a session, set 
>> a variable, jump to a second page, and if the variable doesn't follow, 
>> then there are no cookies.
>>
>> Thanks
>>
>> Jonathan
>>
>>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> 


More information about the FX.php_List mailing list