using <?=SID?> inside a function?
| From: | J!M | Date: | Wed, 13 Sep 0000 00:09:27 +0000 |
| Subject: | using <?=SID?> inside a function? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16510@lists.php.net to get a copy of this message | ||
Hello all,
I'm building some session management routines, and I only want to
pass the session id in the URL when the user is not accepting
cookies - I like to keep my URL's clean if possible, so I don't want
to just use >?=SID?%lt; willy nilly, by enabling trans-sid. I have
a function that writes my links, which will add the session variable
using ?PHPSESSID=$PHPSESSID, but that won't work on the
same page that calls the session.start().
Here's how it works so far, when the user first hits the site, I set
the cookie with session.start() and register a session variable
called $use_sid boolean. I then send the cookie and the URL
parameter. Subsequent pages check for the existence of
$HTTP_COOKIE_VARS["PHPSESSID"] and turns $use_sid on or
off as necessary.
I use a functions to write all of my html, including links, so it's easy
for $use_sid to add the session id to all urls on the page when
necessary.
Here's my problem - on the page that starts the session, the url
rewrite function adds the ?PHPSESSID= but not it's value. On the
same test page, using >?=SID?%lt; works fine. I can only
assume that the >?=SID?%lt; rewrite happens after the page
code is written. Can anyone suggest a work around to make that
value available, or provide syntax for using SID within a function. I
have only seen it written as >?=SID?%lt; which won't work for
my use.
Any suggestions - no example I've encountered treats the session
id this way.
Thanks,
J!M