in reply to Random directory creation/deletion scheduling logic problem

Rather than create a random directory name, create a link name which encodes expire time and possibly a small numeric key for security (serial number or partial MD5 or whatever). It is then easy to expire access by examining the link names, pulling out the expire time and deleting the link as appropriate. That even scales very nicely to selling n days worth of access.

There is a hint "keep track of which one is still valid to be "sold"" that only one user may have access at a time. If that is the case the link name should include the target dir name so you can search (using readdir for example) to see if the material is in use or not.


DWIM is Perl's answer to Gödel
  • Comment on Re: Random directory creation/deletion scheduling logic problem

Replies are listed 'Best First'.
Re^2: Random directory creation/deletion scheduling logic problem
by hmbscully (Scribe) on Nov 17, 2005 at 20:10 UTC
    No, as many users as have purchased can access the links at a time. Its just flash and html, no restrictions on users.

    I'm thinking that I want to change the directory name because there will actually be 4 separate links, i.e.

    http://www.mysite.org/randomdirectory/link1.html<br> http://www.mysite.org/randomdirectory/link2.html<br> http://www.mysite.org/randomdirectory/link3.html<br> http://www.mysite.org/randomdirectory/link4.html<br>

    A buyer could purchase just one, a combination of two or three, or all four at once. Keeping track of 4 different links seems like even more work. Or maybe its not and I'm just imagining all this badly. We don't need real stringent security, it isn't a high stakes selling price.

    But out of curiosity, how would one encode an expire time to a file name?

      You can do the link and time like this:

      http://www.mysite.org/hard_links/link1_200511191927.html http://www.mysite.org/hard_links/link2_200511191927.html

      which sets the expiry time to 19th nov. 2005, 19:27 (local or UT as you like).


      DWIM is Perl's answer to Gödel