Re: Where is SID?

From: Dave Patton (spam_at_trap.invalid)
Date: 02/22/05


Date: Tue, 22 Feb 2005 16:57:56 GMT

Michael Satterwhite <michael.XREMOVETHIS@weblore.com> wrote in
news:02xSd.29075$cW2.7823@fe2.texas.rr.com:

> OK, I'll admit I've been doing it wrong (using session_register()), so
> I'm trying to correct my ways, but...
>
> My script starts with
><?php
> session_start();
> ?>
>
> In the body of my page a link as follows:
>
> Target text
>
> Problem: SID is an empty string. I even tried
> echo "SID: " . SID . '<br />';
>
> and SID echoes as an empty string. Why?

Because you have cookies enabled, and are accepting
a cookie from your domain with the PHP page, and using
a browser that supports cookies ;-)

Do yourself a favour and use the Firefox browser, and
get the LiveHTTPHeaders extension. You can then see
the 'HTTP conversation' between your browser and the
server, and you'll see the session cookie being set,
and returned.

http://www.php.net/manual/en/ref.session.php

Predefined Constants
--------------------
SID (string)
Constant containing either the session name and session ID in
the form of "name=ID" or empty string if session ID was set in
an appropriate session cookie.

Passing the Session ID
----------------------
Alternatively, you can use the constant SID which is always defined.
If the client did not send an appropriate session cookie, it has the
form session_name=session_id. Otherwise, it expands to an empty string.
Thus, you can embed it unconditionally into URLs.

-- 
Dave Patton
Canadian Coordinator, Degree Confluence Project
http://www.confluence.org/
My website: http://members.shaw.ca/davepatton/


Relevant Pages

  • Re: Question Regarding Session ID
    ... > SID is only set if the client rejects the session cookie. ... session_id() returns the session id for the current session. ...
    (comp.lang.php)
  • Re: Attachments to MAPI Message
    ... 'specifies whether a new mail session should be ... 'is provided for sign-on. ... The default is an empty string. ...
    (microsoft.public.vb.controls.internet)
  • Re: Reality Check: Session Hijacking
    ... The user is always challenged when he starts to use a secure app, ... And NOT from the session. ... rest of the http response, so he also has the required post data. ... > exposes his session cookie over unencrypted http. ...
    (comp.lang.php)
  • Re: Can SID be trusted?
    ... Jerry Stuckle wrote: ... [Having the session ID in SID even when cookies are used] ... in SID - and, not knowing any better, gets the session id and places it ...
    (comp.lang.php)
  • nxclient stopped working after xorg upgrade
    ... deb-src http://debian.tu-bs.de/project/kanotix/unstable/ sid nx ... After upgrading sid machine to the latest xorg, nxclient stopped working. ... NX> 703 Session type: unix-kde ...
    (Debian-User)