For my current project (using PHP - Codeigniter ) user can upload there photos to the server. If the user is not registered / logged in I am creating a temporary id for the user and creates a folder with same name. And after logging in/ register I can change the folder name to the user ID.
So if the user is not authenticating identity I need to delete that entire folder from my server.
And the problem I am facing is that I need to know when ever the session is no longer active. So I could delete the folders.
The pobablities I found are when closing the browser, if the user system gone switch off, etc I need to delete those folders.
It will be great help if some one could suggest me how to implement this functionality.
Some js functions could detect through any browser actions. I think it willl be better to have a comination of js and server side codes,
Thanks in advance.