[thelist] PHP session id's

Anthony Baratta Anthony at Baratta.com
Fri Sep 13 10:03:01 CDT 2002


At 12:31 AM 9/13/2002, Pablo Oliva wrote:
>I was previously, before PHP version 4.2.1, able to append the session
>id to a redirect like so:
>header ( 'Location: ../comp/compIndex.php?'.SID );
>
>Has this changed, or am I making some other mistake.  I looked at
>PHP.net and they make no reference to this being invalid now.

The name of variables has changed with v 4.1.0, with the addition of the
option register_globals.

e.g.

http://www.php.net/manual/en/reserved.variables.php

Session variables: $_SESSION

Note: Introduced in 4.1.0. In earlier versions, use $HTTP_SESSION_VARS.

An associative array containing session variables available to the current
script. See the Session functions documentation for more information on how
this is used.

This is a 'superglobal', or automatic global, variable. This simply means
that it is available in all scopes throughout a script. You don't need to
do a global $_SESSION; to access it within functions or methods, as you do
with $HTTP_SESSION_VARS.

$HTTP_SESSION_VARS contains the same information, but is not an autoglobal.

If the register_globals directive is set, then these variables will also be
made available in the global scope of the script; i.e., separate from the
$_SESSION and $HTTP_SESSION_VARS arrays. For related information, see the
security chapter titled Using Register Globals. These individual globals
are not autoglobals.


Also see:

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


---
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."




More information about the thelist mailing list