Forum Moderators: coopster

Message Too Old, No Replies

Session management

trying to pick a good strategy for session management

         

HeadBut

4:26 pm on Jul 25, 2005 (gmt 0)

10+ Year Member



What is the difference between:
session_register('username');
and
$_SESSION["username"]

is there a global session var that an admin can access?

vincevincevince

5:43 pm on Jul 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is no need to use session_register();

Just ensure that you call session_start(); before you want to access $_SESSION and you will find it is already global.

coopster

1:08 am on Jul 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



vvv is right.


Note: Please note when working with sessions that a record of a session is not created until a variable has been registered using the session_register() function or by adding a new key to the $_SESSION superglobal array. This holds true regardless of if a session has been started using the session_start() function.


Use of $_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended for improved security and code readability. With $_SESSION, there is no need to use the session_register(), session_unregister(), session_is_registered() functions. Session variables are accessible like any other variables.

Resource:
[php.net...]