473,289 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Recording user session durations

PWS
Hi all,

I developed an online learning website where each student has his own
username/password and they can view course materials and take tests
online. I did that in PHP and PostgreSQL.

Now, I need to implement a function that I don't seem to be doing
right. A course has multiple modules under it and a module has several
pages, all are done in PHP. I am required to log the times (durations)
each student spends on a module. Duration is counted as the total time
a student spends reading pages of a module and taking the test.
Duration counting stops when the student passed the module test. It's
not (start time - end time). It might take 3 days for a student to
read a module's materials and take the test, however, the actual
duration he spent on the module might be 10 hours.

To make things more complicated, there is no sequence a student reads
modules. He can read some pages in module 1, jump to module 5 and come
back to module 1 again.

I tried to tackle this problem using PHP, Javascript and cookies. When
a new student opens a page of a module, that time is Starttime,
written to the duration field of a table in postgres. At the same
time, that page will create a cookie for that module and javascript is
used to start a timer on user's PC. When the user leaves that page,
that timer is stopped and duration is recorded in the cookie. When the
user visits another page of the module, if there is a duration
recorded in the module's cookie, it is added to the duration field in
the postgres table. The duration field in the cookie is then reset and
javascript timer starts again. When the user has passed the module
test, duration counting stops and the end time is recorded.

It's not an elegant solution I know but that's the only way I can
think of since PHP alone can't handle the duration recording. When I
tested it with many users, I see mixed results. Some durations seem to
be ok but some are way off; either too big or too small (like 0.5
minutes). I tried different ways but it doesn't solve the problem.

I have been searching for a solution to this problem and haven't found
anything. If anyone can suggest me a solution, I would really
appreciate.

Thanks.
Sep 23 '08 #1
2 2176
On 23 Sep, 11:44, PWS <phyow...@gmail.comwrote:
Hi all,

I developed an online learning website where each student has his own
username/password and they can view course materials and take tests
online. I did that in PHP and PostgreSQL.

Now, I need to implement a function that I don't seem to be doing
right. A course has multiple modules under it and a module has several
pages, all are done in PHP. I am required to log the times (durations)
each student spends on a module. Duration is counted as the total time
a student spends reading pages of a module and taking the test.
Duration counting stops when the student passed the module test. It's
not (start time - end time). It might take 3 days for a student to
read a module's materials and take the test, however, the actual
duration he spent on the module might be 10 hours.

To make things more complicated, there is no sequence a student reads
modules. He can read some pages in module 1, jump to module 5 and come
back to module 1 again.

I tried to tackle this problem using PHP, Javascript and cookies. When
a new student opens a page of a module, that time is Starttime,
written to the duration field of a table in postgres. At the same
time, that page will create a cookie for that module and javascript is
used to start a timer on user's PC. When the user leaves that page,
that timer is stopped and duration is recorded in the cookie. When the
user visits another page of the module, if there is a duration
recorded in the module's cookie, it is added to the duration field in
the postgres table. The duration field in the cookie is then reset and
javascript timer starts again. When the user has passed the module
test, duration counting stops and the end time is recorded.

It's not an elegant solution I know but that's the only way I can
think of since PHP alone can't handle the duration recording. When I
tested it with many users, I see mixed results. Some durations seem to
be ok but some are way off; either too big or too small (like 0.5
minutes). I tried different ways but it doesn't solve the problem.

I have been searching for a solution to this problem and haven't found
anything. If anyone can suggest me a solution, I would really
appreciate.

Thanks.
This is of course impossible. You have no idea what a student may be
doing at any time.
Sep 23 '08 #2
PWS wrote:
Hi all,

I developed an online learning website where each student has his own
username/password and they can view course materials and take tests
online. I did that in PHP and PostgreSQL.

Now, I need to implement a function that I don't seem to be doing
right. A course has multiple modules under it and a module has several
pages, all are done in PHP. I am required to log the times (durations)
each student spends on a module. Duration is counted as the total time
a student spends reading pages of a module and taking the test.
Duration counting stops when the student passed the module test. It's
not (start time - end time). It might take 3 days for a student to
read a module's materials and take the test, however, the actual
duration he spent on the module might be 10 hours.

To make things more complicated, there is no sequence a student reads
modules. He can read some pages in module 1, jump to module 5 and come
back to module 1 again.

I tried to tackle this problem using PHP, Javascript and cookies. When
a new student opens a page of a module, that time is Starttime,
written to the duration field of a table in postgres. At the same
time, that page will create a cookie for that module and javascript is
used to start a timer on user's PC. When the user leaves that page,
that timer is stopped and duration is recorded in the cookie. When the
user visits another page of the module, if there is a duration
recorded in the module's cookie, it is added to the duration field in
the postgres table. The duration field in the cookie is then reset and
javascript timer starts again. When the user has passed the module
test, duration counting stops and the end time is recorded.

It's not an elegant solution I know but that's the only way I can
think of since PHP alone can't handle the duration recording. When I
tested it with many users, I see mixed results. Some durations seem to
be ok but some are way off; either too big or too small (like 0.5
minutes). I tried different ways but it doesn't solve the problem.

I have been searching for a solution to this problem and haven't found
anything. If anyone can suggest me a solution, I would really
appreciate.

Thanks.
You can't reliably recored durations such as this with PHP and/or
javascript. It's just not possible.

You know the problem with doing it server-side. And many users have
their browsers set to delete cookies when the browser is closed, so your
cookie idea is bound to fail. And what happens if the student accesses
the page from two (or more) computers (or two or more students share a
computer)?

A java applet is probably your best way to go for something like this.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 23 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: dvaughan | last post by:
i'd like to make a web page that records things the remote user says i've been working with the SASDK since that's a pretty obvious place to start. i don't currently require the recognition...
3
by: Jussi Rasku | last post by:
Hello, I'm working on a small web-script that would allow me to remotely setup recordings to my tv-tuner (on my linux box). The idea is simple, but I'm unsure how to accomplish it. The idea:...
1
by: Sakharam Phapale | last post by:
Hi All, I am developing an application like sound recorder. While recording if there is a silence for more than given time (say 5 seconds), Recording should be paused.
1
by: John Bailo | last post by:
I'm doing a profile on my SQL Server to see if I can eliminate any long running statements, and periodically, I see an entry for ".NET SqlClient Data Provider". The durations for it are very...
7
by: Seymour | last post by:
I am trying to find a way to sign onto my Wall Street Journal account (http://online.wsj.com/public/us) and automatically download various financial pages on stocks and mutual funds that I am...
2
by: rockdale | last post by:
Hi, all: I need to implement a recording functionality on my asp.net webpage. the rough idea is user click a button, then I start recording what the user speaked and then save it as a wave file...
2
by: Anthony | last post by:
I have a team website that has several games for entertainment. One of the games is a javascript version of yahtzee. Can someone suggest a way, using javascript, to record a high score for the...
2
by: tiffxi | last post by:
I'm an ASP.NET newbie. I'm trying to write an audio-recording code in an ASP.Net page. I created a windows User Control that has the buttons and codes for this (it calls the winmm.dll in system32...
241
by: jrdacc.i | last post by:
what is the difference between the tree storage durations(static,automatic and dynamic) in C?
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.