[SOLVED] Accessing PHPSESSID
Moderator: General Moderators
[SOLVED] Accessing PHPSESSID
Can $_SERVER['HTTP_COOKIE'] be accessed as an array ?
Right now I have register_globals On and access the session id as $PHPSESSID.
$_SERVER['HTTP_COOKIE']['PHPSESSID'] doesnt seem to work.
Thanks
Right now I have register_globals On and access the session id as $PHPSESSID.
$_SERVER['HTTP_COOKIE']['PHPSESSID'] doesnt seem to work.
Thanks
Last edited by anjanesh on Wed Aug 03, 2005 2:26 am, edited 1 time in total.
Aren't cookies and sessions two different ways of requesting information? I can't see how they could be stored in an array like you have mentioned.
http://us3.php.net/reserved.variables mentions nothing of PHPSESSID, so it is not a part of the $_SERVER superglobal.
http://us3.php.net/reserved.variables mentions nothing of PHPSESSID, so it is not a part of the $_SERVER superglobal.
Im a master in Posting in forums - not yet in PHP though.scrotaye wrote: Then again, you are ranked a 'master' so I will believe what you say!
Code: Select all
echo '<pre>';print_r($_SERVER);echo '</pre>';Code: Select all
Array
(
.
.
.
[HTTP_COOKIE] => PHPSESSID=f9visti34oagm4kusv5rilc957
.
.
.
)- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
$_SERVER['HTTP_COOKIE'] is the raw cookie string that is sent by the browser. $_COOKIE is the exploded out version of that. parse_str() can perform this explosion..
I last q.
What if cookies are not enabled ? Then it'll automatically go via URL right ?
So it'll be $_GET['PHPSESSID'] instead of $_COOKIE['PHPSESSID'].
In that wouldnt $PHPSESSID be easier to access ? register_globals On only for this.
What if cookies are not enabled ? Then it'll automatically go via URL right ?
So it'll be $_GET['PHPSESSID'] instead of $_COOKIE['PHPSESSID'].
In that wouldnt $PHPSESSID be easier to access ? register_globals On only for this.
Last edited by anjanesh on Thu Dec 22, 2005 1:07 am, edited 1 time in total.