How do I make sens of session data?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I make sens of session data?

David Bergkvist

I have a forum solution with several different forums in the same
database. All users log in and it all runs on sessions in LP 7.x. Works
great.
One basic function is that you can see the names of who else is logged
in. The code for this is below.

When moving this to LP 8.5 my code is no good since the content in the
data field in the sessions table is now, well if not encrypted, at
least not plain text anymore.

How do I make sens of the content in the data field so I can pull out
the names of the users that are logged in to the forum in question?

/David Bergkvist
Webworks
[hidden email]

------------------------------------

[If: (var: 'ForumID')!='']
[var: 'datetimelimit'=(date_format: (date_subtract:
     (date_getcurrentdate),
     -minute=30),
   -format='%Y%m%d%H%M%S')]

[var: 'Data'='>' + (var: 'ForumID')]
[inline: -database='site',
-Username='zzzzzz',
-Password='yyyyyy',
   -table='sessions',
   -op='bw',
   'session_key'='_SessionTracker_FORUM_',
    -op='gte',
   'last_access'=(var: 'datetimelimit'),
   -op='cn',
   'Data'=(var: 'Data'),
   -maxrecords=100,
   -search]
[var: 'Online'=(found_count)]
  [var: 'Online'] st<BR>
[if:(Error_CurrentError: -errorcode) !=(Error_NoError)]
                                [Var: 'Felkod' = (Error_CurrentError: -errorcode)]
                        [/If]
                        [Records]
[var: 'Begin' = (String_FindPosition: (Field: 'Data'), -Find='<var
key="Name"><stringType>')]

[var: 'Start' = (var: 'Begin') + 28]
[var: 'Name' =(String_Extract: (Field: 'Data'), -StartPosition=(var:
'Start'), -EndPosition=900)]
[var: 'Length' = (String_Length: (var: 'Name'))]
[var: 'Endpos' = (var: 'Length') - 31]
[String_Extract: (var: 'Name'), -StartPosition=1, -EndPosition=(var:
'Endpos'), -EncodeNone]<BR>
                        [/Records]
                        <!-- Fel: [var: 'Felkod'] -->
[/inline]

[/If]


------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: How do I make sens of session data?

stevepiercy
What do you mean "make sense of the content in the data field"?  I mean, didn't you write the app to put content into the data field?

--steve


On Friday, August 18, 2006, [hidden email] (David Bergkvist) pronounced:

>
>I have a forum solution with several different forums in the same
>database. All users log in and it all runs on sessions in LP 7.x. Works
>great.
>One basic function is that you can see the names of who else is logged
>in. The code for this is below.
>
>When moving this to LP 8.5 my code is no good since the content in the
>data field in the sessions table is now, well if not encrypted, at
>least not plain text anymore.
>
>How do I make sens of the content in the data field so I can pull out
>the names of the users that are logged in to the forum in question?
>
>/David Bergkvist
>Webworks
>[hidden email]
>
>------------------------------------
>
>[If: (var: 'ForumID')!='']
>[var: 'datetimelimit'=(date_format: (date_subtract:
>     (date_getcurrentdate),
>     -minute=30),
>   -format='%Y%m%d%H%M%S')]
>
>[var: 'Data'='>' + (var: 'ForumID')]
>[inline: -database='site',
>-Username='zzzzzz',
>-Password='yyyyyy',
>   -table='sessions',
>   -op='bw',
>   'session_key'='_SessionTracker_FORUM_',
>    -op='gte',
>   'last_access'=(var: 'datetimelimit'),
>   -op='cn',
>   'Data'=(var: 'Data'),
>   -maxrecords=100,
>   -search]
>[var: 'Online'=(found_count)]
>  [var: 'Online'] st<BR>
>[if:(Error_CurrentError: -errorcode) !=(Error_NoError)]
>               [Var: 'Felkod' = (Error_CurrentError: -errorcode)]
>           [/If]
>           [Records]
>[var: 'Begin' = (String_FindPosition: (Field: 'Data'), -Find='<var
>key="Name"><stringType>')]
>
>[var: 'Start' = (var: 'Begin') + 28]
>[var: 'Name' =(String_Extract: (Field: 'Data'), -StartPosition=(var:
>'Start'), -EndPosition=900)]
>[var: 'Length' = (String_Length: (var: 'Name'))]
>[var: 'Endpos' = (var: 'Length') - 31]
>[String_Extract: (var: 'Name'), -StartPosition=1, -EndPosition=(var:
>'Endpos'), -EncodeNone]<BR>
>           [/Records]
>           <!-- Fel: [var: 'Felkod'] -->
>[/inline]
>
>[/If]
>
>
>------------------------------
>LASSO MASTER CLASS - Orlando, FL
>Following the FileMaker Developer Conference
>2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
>http://www.briandunning.com/lasso-training/
>
>
>------------------------------
>Lasso Support: http://support.omnipilot.com/
>Search the list archives: http://www.listsearch.com/lassotalk.lasso
>Manage your list subscription:  
>http://www.listsearch.com/lassotalk.lasso?manage
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy               Web Site Builder               Soquel, CA
<[hidden email]>                   <http://www.StevePiercy.com>

------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: How do I make sens of session data?

Ke Carlton
In reply to this post by David Bergkvist

I think the easiest solution would be to create your own method for tracking
who's online. As opposed to trying to reverse engineer the new session db.

There's a number of simple ways to do it, I would recommended having a
simple three 3 field database consisting of:

        A) User_id (primary keyfield)
        B) Public Name
        C) Timestamp field

Then define an atBegin that runs this simple SQL call when needed:

        Insert into users_online(id,name) values ("'$user_id'","'$name'")
        On duplicate key update name = values(name)

To display who's online:

        Select name from users_online where datetime > 20060818091500

Every so often you can delete the older records - or you could just keep
them there to the when users where last online. You can modify this setup to
track what page they're / were last on etc...

Ke











-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf
Of David Bergkvist
Sent: 18 August 2006 00:49
To: [hidden email]
Subject: How do I make sens of session data?


I have a forum solution with several different forums in the same
database. All users log in and it all runs on sessions in LP 7.x. Works
great.
One basic function is that you can see the names of who else is logged
in. The code for this is below.

When moving this to LP 8.5 my code is no good since the content in the
data field in the sessions table is now, well if not encrypted, at
least not plain text anymore.

How do I make sens of the content in the data field so I can pull out
the names of the users that are logged in to the forum in question?

/David Bergkvist
Webworks
[hidden email]

------------------------------------

[If: (var: 'ForumID')!='']
[var: 'datetimelimit'=(date_format: (date_subtract:
     (date_getcurrentdate),
     -minute=30),
   -format='%Y%m%d%H%M%S')]

[var: 'Data'='>' + (var: 'ForumID')]
[inline: -database='site',
-Username='zzzzzz',
-Password='yyyyyy',
   -table='sessions',
   -op='bw',
   'session_key'='_SessionTracker_FORUM_',
    -op='gte',
   'last_access'=(var: 'datetimelimit'),
   -op='cn',
   'Data'=(var: 'Data'),
   -maxrecords=100,
   -search]
[var: 'Online'=(found_count)]
  [var: 'Online'] st<BR>
[if:(Error_CurrentError: -errorcode) !=(Error_NoError)]
                                [Var: 'Felkod' = (Error_CurrentError:
-errorcode)]
                        [/If]
                        [Records]
[var: 'Begin' = (String_FindPosition: (Field: 'Data'), -Find='<var
key="Name"><stringType>')]

[var: 'Start' = (var: 'Begin') + 28]
[var: 'Name' =(String_Extract: (Field: 'Data'), -StartPosition=(var:
'Start'), -EndPosition=900)]
[var: 'Length' = (String_Length: (var: 'Name'))]
[var: 'Endpos' = (var: 'Length') - 31]
[String_Extract: (var: 'Name'), -StartPosition=1, -EndPosition=(var:
'Endpos'), -EncodeNone]<BR>
                        [/Records]
                        <!-- Fel: [var: 'Felkod'] -->
[/inline]

[/If]


------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on
the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage

------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: How do I make sens of session data?

David Bergkvist
In reply to this post by stevepiercy
2006-08-18 kl. 04.46 skrev Steve Piercy - Web Site Builder:

> What do you mean "make sense of the content in the data field"?  I
> mean, didn't you write the app to put content into the data field?

Not really. The database I'm talking about is the built-in sessions
table in the site database. In that table there is a field named "Data"
where Lasso store all session data (I guess) and that's where I want to
get in. I can search the table but I only get garbage when I display
the content of the field "Data".

I can also pull out the session vars for each session from within the
session in question but what I want to do is to pull out data from all
session (or at least from one group of sessions). The idea is to be
able to display data about all logged in users, like name and perhaps
more for all logged in users.

Building a solution of my own like Ke suggested has crossed my mind but
it just seems silly to have to reinvent the wheel when all I want is to
use the session function that is already built in to Lasso.

Since it worked in LP 7.x, what great things did they add to the
session function that demanded that the data in the sessions table
needed to be "encrypted" (or what ever it is)?

/David
________________________________
Webworks AB   http://www.webworks.se/
Stockholm / Lund / Malmö (Sweden)
David Bergkvist

------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: How do I make sens of session data?

Fletcher Sandbeck
On 2006-08-18 at 20:44 by [hidden email] (David Bergkvist):

>> What do you mean "make sense of the content in the data field"?  I
>> mean, didn't you write the app to put content into the data field?
>
>Not really. The database I'm talking about is the built-in sessions
>table in the site database. In that table there is a field named "Data"
>where Lasso store all session data (I guess) and that's where I want to
>get in. I can search the table but I only get garbage when I display
>the content of the field "Data".
>
>I can also pull out the session vars for each session from within the
>session in question but what I want to do is to pull out data from all
>session (or at least from one group of sessions). The idea is to be
>able to display data about all logged in users, like name and perhaps
>more for all logged in users.

The source code for the session manager is included with Lasso.  It is in the Documentation/3 - Language Guide/LassoApps/Startup folder.  Look at the session_drivers.lasso file to see how Lasso reads the contents from the database (and how the encoding depends on the database being used).

The code for the [Session_Start] tag is included in the sessiontrackerinit.lasso file.  The code on lines 218 through 272 (in 8.5) shows how we pull out the session data and parse it.  There are several different options so you'd probably want to follow the implementation closely.

>Building a solution of my own like Ke suggested has crossed my mind but
>it just seems silly to have to reinvent the wheel when all I want is to
>use the session function that is already built in to Lasso.
>
>Since it worked in LP 7.x, what great things did they add to the
>session function that demanded that the data in the sessions table
>needed to be "encrypted" (or what ever it is)?

The data is not encrypted.  Lasso 8 uses a different back end database engine so there were some changes required for that.  When SQLite is being used for session storage the data is compressed and hex encoded before it is stored.  When MYSQL is being used for data storage the implementation closely matches that from previous versions.  In Lasso 8.1 the way that session data was serialized was modified in order to improve performance.  And, I believe there have been some low-level changes to the serialization process itself which were done to provide better support for custom types among other things.

[fletcher]
--
Fletcher Sandbeck                         [hidden email]
Director of Product Development       http://www.lassostudio.com
OmniPilot Software, Inc.                http://www.omnipilot.com

------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: How do I make sens of session data?

Bil Corry
Fletcher Sandbeck wrote:
> The code for the [Session_Start] tag is included in the sessiontrackerinit.lasso file.  The code on lines 218 through 272 (in 8.5) shows how we pull out the session data and parse it.  There are several different options so you'd probably want to follow the implementation closely.

This would probably help to get you started:

  <http://www.listsearch.com/lassotalk.lasso?id=154740>


- Bil


------------------------------
LASSO MASTER CLASS - Orlando, FL
Following the FileMaker Developer Conference
2 Day intensive seminar: Learn the best way to get your FileMaker data on the web.
http://www.briandunning.com/lasso-training/


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage