views:

42

answers:

3

Hi, At localhost (Debian Sid machine), PHP creates session files in /var/lib/php5. When I open sess_cd2ct9hud284gn01os13nk5mi7, for example, i can see something like that:

Qms6wztHQ9u79B7jjiihLX0cKc_fXgwo0NeVE34jFhdE__1JDOliUDteHQVXgMAjcGZgJ1EkBft0IUsqBdWrck7s0Vjghsm3vk681u_GV8KRK-ExrAEbvbgXfl51Z83tyh5h2JtRy0qLZmhqwLtUFykm1XbdBBxx5xJpNpg4z_ccvOW2-k947-pn_L40lK_ZybK-9gTvD3giGy9pvtNHAoFuUE0KLH9kE87vTWKt4pbf-Upm3_VGLyu5yCqkWAxfJHILmlb1wAqfIssnS632YA..

How could I read the real value of the session using this file? Is this a base64_hash? Thank you!

PS: Sorry about my english.

A: 

sess_cd2ct9hud284gn01os13nk5mi7 cd2ct9hud284gn01os13nk5mi7 this is the session id, its in the name of the file

Grumpy
OK, i got it. But how could i see the session value with the sess_cd2ct9hud284gn01os13nk5mi7 file's content?
Thomas Yorke
+2  A: 

If you know the "name" or the id of the session you could read it within PHP.

// $oldName = session_name( "[session name here]" );
$oldId = session_id(); session_id( "[new id]" );
session_start();

// Do something..
var_dump( $_SESSION );

// Get back to first session
// session_name( $oldName );
session_id( $oldId );
session_start();

You could also try the session_decode() function, which loads the contents of a serialized session into the $_SESSION superglobal.

svens
A: 

Here's the answer for that: http://forum.imasters.uol.com.br/index.php?/topic/405280-ler-valor-de-um-arquivo-de-sessao/ Thank you.

Thomas