Retrieve all SESSION variables.

Retrieve all SESSION variables.

am 25.05.2007 17:29:07 von Alf C Stockton

Is there a method whereby one can retrieve all php SESSION variables on
a Windows server.
I have tried:-

session_start();
foreach($_SESSION as $key => $val)
{
echo $key . " : " . $val . "
";
}
?>

but this appears to only return current user variables.

--
Regards,
Alf Stockton www.stockton.co.za

Let us endeavor so to live that when we come to die even the undertaker
will be
sorry.
-- Mark Twain, "Pudd'nhead Wilson's Calendar"
My email disclaimer is available at www.stockton.co.za/disclaimer.html

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Retrieve all SESSION variables.

am 25.05.2007 17:50:27 von Stut

Alf Stockton wrote:
> Is there a method whereby one can retrieve all php SESSION variables on
> a Windows server.
> I have tried:-
>
> > session_start();
> foreach($_SESSION as $key => $val)
> {
> echo $key . " : " . $val . "
";
> }
> ?>
>
> but this appears to only return current user variables.

Shocking that. You think maybe there's some security-related reasoning
behind that?

Seriously tho, if you really really really need to do this, and I can't
think of a single good reason you would, you need to be looking at where
PHP is storing the session data as it provides no way to access other
users session data due to the aforementioned security-related reasoning.

-Stut

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Retrieve all SESSION variables.

am 25.05.2007 18:12:03 von Jarrett Meyer

I think Stut is being a little sarcastic. :)

The
original question is correct: The method below ( foreach ($_SESSION as
$k => $v) ... ) will only tell you the current session variables for
the current user. That is intentional in the design of the $_SESSION
variable.

It will not tell you all of the possible session
variables or what another user may have as their session variables.
(i.e. if you haven't logged on to a page, you may not have a
$_SESSION["logon_timestamp"] key, even though it is a key that some
future page may care about.

You need to find how the sessions
are stored (file or DB) and look there. You can then parse the hash to
look at all of the available sessions.

(sorry for the previous message... need to check the "To" before hitting "Send".)

jm
----
Jarrett M. T. Meyer
http://jarrettmeyer.blogspot.com
http://www.jarrettmeyer.com

No trees were harmed during this transmission; however, several electrons were terribly inconvenienced.

----- Original Message ----
From: Stut
To: Alf Stockton
Cc: php windows
Sent: Friday, May 25, 2007 11:50:27 AM
Subject: Re: [PHP-WIN] Retrieve all SESSION variables.

Alf Stockton wrote:
> Is there a method whereby one can retrieve all php SESSION variables on
> a Windows server.
> I have tried:-
>
> > session_start();
> foreach($_SESSION as $key => $val)
> {
> echo $key . " : " . $val . "
";
> }
> ?>
>
> but this appears to only return current user variables.

Shocking that. You think maybe there's some security-related reasoning
behind that?

Seriously tho, if you really really really need to do this, and I can't
think of a single good reason you would, you need to be looking at where
PHP is storing the session data as it provides no way to access other
users session data due to the aforementioned security-related reasoning.

-Stut

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Retrieve all SESSION variables.

am 25.05.2007 19:33:17 von Alf C Stockton

Stut wrote:
> Alf Stockton wrote:
>> Is there a method whereby one can retrieve all php SESSION variables
>> on a Windows server.
>> I have tried:-
>>
>> >> session_start();
>> foreach($_SESSION as $key => $val)
>> {
>> echo $key . " : " . $val . "
";
>> }
>> ?>
>>
>> but this appears to only return current user variables.
>
> Shocking that. You think maybe there's some security-related reasoning
> behind that?
>
Try sysadmin wants to know who is doing what.

--
Regards,
Alf Stockton www.stockton.co.za

O, it is excellent
To have a giant's strength; but it is tyrannous
To use it like a giant.
-- Shakespeare, "Measure for Measure", II, 2
My email disclaimer is available at www.stockton.co.za/disclaimer.html

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Retrieve all SESSION variables.

am 25.05.2007 21:44:42 von Stut

Alf Stockton wrote:
> Stut wrote:
>> Alf Stockton wrote:
>>> Is there a method whereby one can retrieve all php SESSION variables
>>> on a Windows server.
>>> I have tried:-
>>>
>>> >>> session_start();
>>> foreach($_SESSION as $key => $val)
>>> {
>>> echo $key . " : " . $val . "
";
>>> }
>>> ?>
>>>
>>> but this appears to only return current user variables.
>>
>> Shocking that. You think maybe there's some security-related reasoning
>> behind that?
>>
> Try sysadmin wants to know who is doing what.

Tell "sysadmin" to consider what he actually wants to know and whether
there is a better way to get that information. Reading the raw sessions
rarely gives you information you couldn't get from server logs or a
little added logging in the app.

-Stut

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Retrieve all SESSION variables.

am 27.05.2007 16:23:38 von Aleksandar Vojnovic

I'm sure if you explained to us, what are your trying to accomplish, we
might find a more elegant solution then reading the raw session data
from all users.

-AV

Alf Stockton wrote:
> Stut wrote:
>> Alf Stockton wrote:
>>> Is there a method whereby one can retrieve all php SESSION variables
>>> on a Windows server.
>>> I have tried:-
>>>
>>> >>> session_start();
>>> foreach($_SESSION as $key => $val)
>>> {
>>> echo $key . " : " . $val . "
";
>>> }
>>> ?>
>>>
>>> but this appears to only return current user variables.
>>
>> Shocking that. You think maybe there's some security-related
>> reasoning behind that?
>>
> Try sysadmin wants to know who is doing what.
>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php