For my app I need something like database of online users. I want to add user to database by OnGet()
function. When user leave site his data should be deleted from database. I search for some event or whatewer which can run my deleting function. I´m sorry for my english and possibly wrong formulated question. Thanks for reply.
1 Answer
There is no OnLeave()
that would be of any use to you because it's possible that the user shuts down their computer and so your code wouldn't necessarily execute. Or your web site could crash unexpectedly and your code wouldn't run.
Instead, have a script that runs once a day and deletes all users who haven't visited in 24 hours. (Or have it run as often as you like, with whatever "purge" logic you want.)
Session
instead?