We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33453
    • 141 Posts
    I create a number of temporary files for each user when they log in, in a directory temp/username.

    If the user logs out then it’s simple to delete these files, but what if they just navigate away or close the browser? My question is how do I tidy up in this case?

    1. Does MODx have a session timeout and, if so, how can I make use of it?

    2. If I run a cron task can I interface with MODx to find out if a user is logged in?

    Any suggestions welcome.

    Thanks
    • Why would you want to create temp files that seems to only be applicable to the session? In those cases, you can make use of the super-global $_SESSION variables to store the information, and the server will handle the temp file cleanup automatically. Otherwise, you’ll have to try and make use of the Apache/PHP environment to manage the files in conjunction with session management (if it’s possible).

      [NOTE: I know this is an old post, but just wanted to respond, in case you are still having this issue.]