The SID constant will only be available if the SID has not been stored by a cookie. What I do is use a function like this:
function sid($char)
{
if(strlen(SID))
{
return $char.SID;
}
return true
}
And then for links:
echo "<a href=\"page.php?id=9".sid("&")."\">link</a>";
BUT... Your program should still work at the moment so you could just keep it like that.