Re: using <?=SID?> inside a function?
| From: | Charles Killian | Date: | Wed, 13 Sep 2000 07:21:24 +0000 |
| Subject: | Re: using <?=SID?> inside a function? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16515@lists.php.net to get a copy of this message | ||
Call session_id(). ?PHPSESSID=session_id().
$HTTP_COOKIE_VARS["PHPSESSID"] won't contain a value on the first page
because the client browser hasn't sent the cookie yet (because it was just
set).
And your right in my opinion, forget about the constant SID.
Charles
----- Original Message -----
Sent: Wednesday, September 13, 2000 12:09 AM
Subject: [PHP] using <?=SID?> inside a function?
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net