[2.0.15] Update Session on Page Change MOD

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
5
56%
Very Good
3
33%
Good
1
11%
Fair
0
No votes
Poor
0
No votes
 
Total votes: 9

markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux » Sun Jul 02, 2006 7:44 pm

What you're asking for is certainly possible, but it would require a bit more code, a table where to store session history, a lot more database space (depending on the traffic of the board it could turn the server down), a set of reports to explore all logged information, a method to automatically remove records older than a specified age (a cron task)... and it would add more overhead... for something that is probably logged by the webserver.

Anyway, it seems to me that it would be best implemented this feature with another MOD. This one is so simple that only alters an IF condition in one single file.

Another option that comes to mind would be to get a Google Analytics account, which provides great reports on that direction. There are probably similar services out there, though.
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)

User avatar
nico66s
Registered User
Posts: 132
Joined: Tue Nov 15, 2005 5:41 pm
Location: Padova, Italy
Contact:

Post by nico66s » Mon Jul 03, 2006 1:18 am

Maybe I was asking the wrong question :)

I'm just curious to know what is every user habit on my forum: I thought that this mod, as it't triggered by a page change, could come handy.
I would like to see the "path" inside the board, sort to speak.

markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux » Mon Jul 03, 2006 1:46 am

The phpBB sessions table only keeps track of the latest visited page for each session, so you can see it in Who's Online page and ACP Index. Well, the latest visited page is updated only once in 60 seconds. During that interval, the user could be jumping from page to page and you would not see it properly in those reports.

This MOD just touches an IF statement in the whole phpBB session management code to make phpBB update that information whenever the user visits a new page, not only after 60 seconds, so you get more accurate information in Who's Online reports.

Now, I guess you're thinking on a new feature for those reports, so you could click on a user session row and open a new report to view all pages visited by that particular user. But you need to store that information somewhere (and enough resources to do it). The problem is the phpBB sessions table cannot be used for that, you would have to store all page requests made by all users on a different table.

Probably, such a feature would be handy on certain circumstancies. I agree with you on that, but it looks to me it's a completely different MOD.

You could get that information from your webserver logs too, if/when the need arise.
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)

angelp1ay
Registered User
Posts: 175
Joined: Tue Dec 23, 2003 1:32 pm
Location: Bristol, UK
Contact:

Post by angelp1ay » Fri Dec 22, 2006 3:39 pm

markus_petrux wrote: We could perhaps describe what this MOD does by using a bit of "pseudocode":

This would be standard phpBB behaviour when checking the user session:

IF session not updated in 60 seconds THEN
  1. Update session information in sessions table.
  2. Update session time and current page in users table.
  3. Delete expired sessions.
  4. Update session time in cookies.
ENDIF

Note the user session is updated only after 60 seconds of last update time. During this 60 seconds interval, the user might be jumping from page to page, from forum to forum, and this information gets simply lost.

This MOD solves this "situation" by adding a simple condition to the IF expression:

IF session not updated in 60 seconds OR user changed page THEN
  1. Update session information in sessions table.
  2. Update session time and current page in users table.
  3. Delete expired sessions.
  4. Update session time in cookies.
ENDIF

Surely the code is only run if the user changes page? Would it not be even simpler to just cut the if statement out completely?

The only example I can think where this would result in different behaviour is when the user hits refresh within 60 seconds...

diabolic.bg
Registered User
Posts: 447
Joined: Mon Dec 11, 2006 3:41 pm
Location: Bulgaria, Sofia
Contact:

Re: [2.0.15] Update Session on Page Change MOD

Post by diabolic.bg » Thu May 31, 2007 10:45 am

Cool! Thanks markus_petrux! :D

Post Reply

Return to “[2.0.x] MOD Database Cleanup”