[FX.php List] Tracking the web activity

Alex Gates alex at gandrpublishing.com
Tue Nov 21 13:08:52 MST 2006


This topic from Gjermund got me thinking more about tracking web
activity.

I set up a LoginHistory table in my database that will write system
stats and creates a timestamp when a user logs in.  I then save the
LoginHistory recID in a session variable.
IF the user logs out properly (not the caps on "IF"), the logout page
edits the record and adds "Proper Logout" to a field on the record.  I
have an auto modification timestamp as well - and when the user logs out
it subtracts the original timestamp from the modification timestamp to
give me the session length.

The session length field will be 00:00:00 if the user has logged in but
not logged out.
So, I use an if statement on my table that says if the session length is
00:00:00, the user is logged in.

At first, I thought this was a great way to track users who are
currently logged in.  Then I realized that if the session times out, or
if the user closes the browser, then the original LoginHistory record
wont be modified.  So, my session length will remain 00:00:00 and my
table will say "User is Logged In" forever.

This is obviously not an accurate way to tell how many users are logged
in.

To add to it all, this system must allow multiple people to be logged in
with the same username and password.

I understand that I can get the session_id by echo session_id(); So, it
wouldn’t be hard to write this to the database.  But, that really
doesn’t do much good unless there was a way to see all active sessions
within FileMaker.

Does anyone have any suggestions?  Have any of you found a good solution
to monitor active users without requiring a unique FileMaker username /
password for each user?

I'm in the process of building this system - so there is nothing I can't
test... nothing is publicly online yet.

If javascript hit counters can track how long a user spends on a page,
shouldn’t there be a way to do the same and write to a record in
FileMaker?



Alex P. Gates
-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Gjermund
Gusland Thorsen
Sent: Saturday, November 18, 2006 7:43 AM
To: FX.php Discussion List
Subject: Re: Re: Re: [FX.php List] Tracking the web activity

Ahh, ok

I got it, without TRUE it acts like print_r();

ggt667

2006/11/18, Gjermund Gusland Thorsen <ggt667 at gmail.com>:
> The point is that I do not need it do display on web.
>
> ggt667
>
> 2006/11/18, Erik Andreas Cayré <erik at cayre.dk>:
> >
> > Den 18/11/2006 kl. 10.53 skrev Gjermund Gusland Thorsen:
> >
> > > using
> > > ---
> > >
> > > if( $_REQUEST['debug'] == 1 ) {
> > > print_r( $_REQUEST );
> > > }
> > >
> > > is OK if you are actively working on the site; developing.
> > >
> > > However when the client is using the solution by themselves,
> > > I typically use something like:
> > >
> > >       $q = new FX( $serverIP, $serverPort );
> > >       $q->SetDBData( $db, 'logTheWeb' );
> > >       $q->SetDBPassword( $xmlUser, $xmlPass );
> > >       $q->AddDBParam( 'IP', $_SERVER["REMOTE_ADDR"] );
> > >       $q->AddDBParam( 'browser', $_SERVER["HTTP_USER_AGENT"] );
> > >       $q->AddDBParam( 'script', basename( $_SERVER
> > > [ "SCRIPT_FILENAME" ] ) );
> > > //    $q->AddDBParam( 'webSESSION', var_export( $_SESSION ) );
> > > //    $q->AddDBParam( 'webREQUEST', var_export( $_REQUEST ) );
> > >       $rLog = $q->FMNew();
> > >
> > > However you might see that I commented out two lines,
> > > what I would really like is to put the arrays of current
> > > working data into the log as well... but it just does not work :-(
> > >
> > > Anyone got a clue to how I can put visually hierarchical arrays(
> > > similar to the ones of print_r ) into a FileMaker field without
> > > flattening them?
> >
> >
> > try
> >
> > >       $q->AddDBParam( 'webSESSION', var_export( $_SESSION, TRUE )
);
> > >       $q->AddDBParam( 'webREQUEST', var_export( $_REQUEST, TRUE)
);
> >
> >
> >
> >  From the docs on var_export():
> >
> > mixed var_export ( mixed expression [, bool return] )
> >
> > Returns the variable representation when the return parameter is
used
> > and evaluates to TRUE. Otherwise, this function will return NULL.
> >
> >
> >
> > ---
> > Erik Andreas Cayré
> > Spangsbjerg Møllevej 169
> > DK-6705 Esbjerg Ø
> >
> > Home Tel: +45 75150512
> > Mobile: +45 40161183
> >
> > »If you can't explain it simply, you don't understand it well
enough.«
> > -- Albert Einstein
> >
> > »If you don't have time to do it right, when will you have time to
do
> > it over?«
> > -- John Wooden, basketball coach
> >
> >
> > _______________________________________________
> > FX.php_List mailing list
> > FX.php_List at mail.iviking.org
> > http://www.iviking.org/mailman/listinfo/fx.php_list
> >
>




More information about the FX.php_List mailing list