I really need some help. I'm trying to password protect a directory on my website (to store a demo software). I want it to be in such a way, that the user should have access to the directory (with username & password), but after 1 download, his or her username / password should become inactive. It will be for multiple users.
Would really appreciate help or right direction if any such script exists. I do have PHP & MySQL on my hosting server.
If you are trying to password protect a file, just generate a random download key and set it to expire in a day (you cannot find out from HTTP if the download was successful or not).
So, generate a table with keys and expire dates. Hand these keys to your clients. When the expire date has passed, the key is invalid and the software fails to download.
Of couse, to do this successfully, you would have to move the software outside your webroot, so no one can simply link to it. If that is not a possibility, atleast add a .htaccess rule to that directory that prevents browsing. Something like Deny From All.
A lot of ways to secure this, choose the one that best suits your application.
In order to understand recursion, one must first understand recursion.
If you feel like it, you can read my blog
Signal > Noise