Your work around is how Im doing things at the moment (very annoying
picking up and dropping sessions). PHP's limitation currently is that it
can only handle one session at a time, and as thus, only one set of session
variables.

What Im hoping for is (at some point) there to be a multiple session
handler allowing me to do something like:

  session_start($session_id, $handler);

where $session_id is the session ID I want to use and $handler a string to
be used in conjuntion with a new global variable (like $_*, possibly cakked
$_SESSION).

Given the following code (with $PHPSESSID containing the individual user
session):

  session_start("global", "main");
  session_start($PHPSESSID, "user");
  if ($_SESSION["user"]["status"]->loggedin === true)
    session_start("loggedin", "authed");

FYI: "status" is a session_registered object done on the $PHPSESSID
session, and the "user" element before is from the session_start above it.
Explained further below.

This would give me access to 3 session simultaniously:

 $_SESSIONS["main"][*] would be all the "global" session settings
 $_SESSIONS["user"][*] would be all the individual session settings
 $_SESSIONS["authed"][*] would be all the group loggedin session settings

The benifits of this are (incase they arent obvious)

* "global" could be access from all the user interactions (providing a
working base for pages of any calibre to interact / leave tracking data).

* "user" could be used as sessions are right now. This fundamentally would
tie in the other sessions (as shown above for the "loggedin" session).

* "authed" is only accessed by people who are logged in (as set in
the "user" session)

>From a developer point of view (especially when creating multi-user and
multi-tiered websites) this would be a god send and dramatically increase
PHP's ability to handle sessions.

The equivelent code in PHP is currently very messy and Im hoping if it was
adopted into the session module itself it would be significantly faster
than its PHP counterpart.

Comments, Thoughts and Conceptions are more than welcome.

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd

> Yeah it was disscuessed that the session modules could define and
> handle $_APP so that would be globals for all sessions.
>
> a work around would be to do something like this
>
> $oldsession_id = sessoin_id();
> session_id(1);
> session_start();
> $var = $_SESSION['var'];
> session_desetroy();
> session_id($oldsesion_id);
> session_start();
> echo $var . $_SESSION['local_var'];
> (i didn't run this code might not work logicall it does tho)
>
> it would be much cleaner to do
> session_start();
> echo $_APP['var'] . $_SESSION['local_var'];
>
> and allowing the session modules to handle the $_APP
> (files/mm/msession) variable.
>
> but you bring up a good point.. globals per 'mode'.
> not just 'loggged_in' but.. you could have many 'modes' that you would
> want globaly scoped data assoicated with them.
>
> but you could do something like this too...
> $_APP['logged_in'] = array(some, global, data);
>
> So i guess what im saying... if $_APP global was added then it would
> also solve your other 'scope'.
>
> - Brad
>
>
>
>
>
>
>
>
>
> --- Dan Hardiker <[EMAIL PROTECTED]> wrote:
>> While were talking about session advancement... has anyone ever
>> thought of adding shared sesssions? Consider the following scenario:
>>
>> I have 3 sets of variables:
>>
>>   1. Global Scoped - Variables accessed and altered by anyone entering
>>   my
>> site. EG: a "currently online" array which stores the a list of active
>> users
>>   2. Logged in Scoped - Variables accessed by *anyone* logged in. EG:
>>   if
>> you cache the database stuff in a session then if one user updates the
>> cache the often you want all the logged in users to see that change
>> without having to requery the db
>>   3. Individual Scope - Variables specific to this user (eg: whats my
>>   name,
>> my last ip, when did I last do anything meaningful).
>>
>> Being able to split those scopes up into separate variables would be
>> great and being able to do something along the lines of:
>>
>> $session->global = array of global variables
>> $session->loggedin = 2nd scope
>> $session->personal = personal variables
>>
>> and then have the session module manage those 3 sessions individually.
>>
>>
>> In short - it would be cool if a script could (easily) have access to
>> a multitude of sessions and keep them segregated.
>>
>> --
>> Dan Hardiker [[EMAIL PROTECTED]]
>> ADAM Software & Systems Engineer
>> First Creative Ltd
>>
>>
>>
>> --
>> PHP Development Mailing List <http://www.php.net/>
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Games - play chess, backgammon, pool and more
> http://games.yahoo.com/
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to