Check if PHP session_id is in use

后端 未结 4 1524
既然无缘
既然无缘 2021-01-02 23:25

I am building a web-app that users can upload certain files and work on them through the web-app interface. I need to store these files for the length of a users session. I

4条回答
  •  囚心锁ツ
    2021-01-03 00:19

    If you have access to the crontab or scheduled tasks of the server you could create a php file that only is allowed to execute locally which checks the expiration Date/Time value of all sessions found in your database. Each time a user updates this expiration Date/Time value would be updated to their next timeout value (+30 minutes, etc.).

    Your scheduled task/crontab would find all those users who idled out and clean up the mess they left without logging off. I wouldn't suggest to have your scheduled task/crontab run too often. At least have the reoccurance spaced out a number of minutes that makes sense for your situation.

提交回复
热议问题