in reply to MySQL Session database record

"Expiration appears in cookie fine but not in database record. " The expiration of a cookie and a session are not the same and can differ. A cookie expires after a certain date. A session expires a certain number of secons after the last access of that session.

A blob is a field of undetermined length, they can hold text or binary data. they tend to be treated differently than a text field, and yes its size just floats. in displaying data to you your mysql access program may truncate the data as not to overwhelm your display. As stevieb says using native sql calls like select will probably show you more of the data in a_session

The data in a_session looks kinda like what Dumper produces, it may hold all the data in a format that perl can just eval to get the hash back.

if you use Dumper on what you get back from a $session = new CGI::Session(...); call it will look something like

$VAR1 = bless( { '_CLAIMED_ID' => 'e161892f19c7adb6bcb1e89c26398c0b', '_DATA' => { '_SESSION_ATIME' => 1489198054, '_SESSION_CTIME' => 1489198054, '_SESSION_ETIME' => 604800, '_SESSION_ID' => '223de9081eab77743d4a4a +0cdc0a10f3', '_SESSION_REMOTE_ADDR' => '192.168.231.2 +11', 'attempts' => 0, 'forename' => 'forename', 'isloggedin' => 1, 'lastname' => 'lastname', 'timein' => 1489198054, 'timeout' => 0, 'user_id' => 'uid', 'username' => 'username' }, '_DRIVER_ARGS' => { 'DataColName' => 'a_session', 'Directory' => '/tmp', 'IdColName' => 'id', 'TableName' => 'sessions' }, '_DSN' => { 'driver' => 'file', 'id' => 'md5', 'serializer' => 'default' }, '_OBJECTS' => { 'driver' => bless( { 'DataColName' => + 'a_session', 'Directory' => ' +/tmp', 'IdColName' => ' +id', 'NoFlock' => 0, 'TableName' => ' +sessions', 'UMask' => 432 }, 'CGI::Session:: +Driver::file' ), 'id' => 'CGI::Session::ID::md5', 'serializer' => 'CGI::Session::Serial +ize::default' }, '_QUERY' => undef, '_STATUS' => 23 }, 'CGI::Session' );
i SUSPECT that the $D= part in your table is showing you the '_DATA' => subsection(key) because that is the MEAT and the other subsections(keys)data would be reset each time by the $session = new CGI::Session(...); call anyway. When i called Dumper i had asked it to sort the keys and include nice indenting. The call used in CGI::Session may have told it to not sort the keys (because it doenst matter to an eval), and to make the content as small as possible. the non sorted keys and the truncation by your mysql viewer would explain why different fields show up in different records

Replies are listed 'Best First'.
Re^2: MySQL Session database record
by tultalk (Monk) on Mar 11, 2017 at 04:29 UTC

    Hi: My ignorance exposed I did not see the options on the SQL panel in MyPHP Admin

    $D = {'_SESSION_ID' => '7032f2c7f5a2c721a483dc75fc29595e','isloggedin' => 1,'_SESSION_ETIME' => 604800,'#<expires>#' => 0,'forename' => 'Frankly','lastname' => 'HideIt','attempts' => 0,'_SESSION_REMOTE_ADDR' => '72.168.128.201','username' => 'username','_SESSION_CTIME' => 1489152441,'_SESSION_ATIME' => 1489174279,'sessiondata2' => 'b90af5330dc2c92ec389207ee3e67374','timeout' => 1489173579,'timein' => 1489174279,'user_id' => '89','logattempttimein' => 1489152454};;$D

    Thanks for the edification. Happy Camper