Re: Session SID curio

From: Date: Wed, 26 Feb 2003 08:38:22 +0000
Subject: Re: Session SID curio
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-137202@lists.php.net to get a copy of this message
At 08:22 26.02.2003, Bryan Lipscy said: --------------------[snip]-------------------- >I ran into a weird curiosity playing with sessions. > >Consider this working code: ><? > session_start(); > echo "Session ID == ".SID; >?> --------------------[snip]-------------------- The SID constant contains the session identifier that is to be added to a link, IF NECESSARY. This said: PHP normally uses cookies to transfer the session ID to the client browser (controlled by the ini file setting "session.use_cookies"). If the client browser returns a session cookie there's no need for PHP to rewrite the URL links, thus SID is empty. If the client browser does NOT return a session cookie, SID contains the necessary information for URL rewriting. If you need to generate the SID value regardless of cookie/non-cookie settings, use $sid = session_name() . '=' . session_id(); All this can be found at http://www.php.net/manual/en/ref.session.php and the following pages. -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#137202) next »