Meassure the duration of a user login/session

Hello folks

Im developing a webappliation that people will pay for the time that they use it.

What is the best way to meassure how long time a user is loged in ?

At first I thougth that session_start and session_end would help me, but if the users just closes the browser the session will not be ended until the session time out limit is reached(im well aware that the www is stateless=. Is there any realiable solution on this problem or is there a total different approach to this problem ?

Thanks for any ideas.

Best regards

Magnus

holtisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GavinMannionCommented:
There is no reliable solution.

Depending on what the site does you could change your Session timeout from the default 20 minutes to 2 minutes and then when they sign up they have to agree to pay the extra 2 minutes if they close their browser.

As you are aware it is stateless which makes this type of business plan more difficult to enforce.

You could write the entire site in something like Macromedia Flash which as far as I am aware is not completely stateless. (I could be wrong though).

Your other option would be to get the site to call an AJAX control every minute and once that request does not come through for a minute clsoe the session and send the bill

Cheers,
Gavin
0
holtisAuthor Commented:
Ajax could be a possiblity but how reliable would this be ?

One approach could be that one set a time out limit to 20 minutes, on each page request you confirm to the billing database that this session is still acitve(could be a field like "lastupdate") and on each page one could integrate a ajax call that would confirm that the session is still active.

This would mean that when ever the browser is closed we would still know how long the session was active. What would be the main disadvantages of this solution ?

Can a user some how stop the ajax calls(by using the stop buttom in the webbrowser)?
0
GavinMannionCommented:
If you enforced Javascript to view the page then it shouldbe quite reliable.

They cannot call stop, however they can process all requests through a personal proxy and stop it there...
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

GavinMannionCommented:
Decent solution offered.
0
holtisAuthor Commented:
Hi.

Sorry not for replying earlier. None of the ideas really lead to a solution. However this thread can be closed.

Best regards
0
GranModCommented:
PAQed with no points refunded (of 500)

GranMod
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.