Hi,
I'm trying to figure out the best way to determine if a user is currently downloading a file from my website.
The way my site works, is the user waits 30 seconds and views an ad. After the timer is up the download becomes available.
I heard that I could probably use a timestamp or something of the sort. I've read up on it but not sure how I could go about this.
Checking if user is currently downloading a file
Moderator: General Moderators
Re: Checking if user is currently downloading a file
Create some sort of download ID in your database. It relates a user with a download. It also knows when the download was requested, whether it's in the show-an-ad state or the doing-the-download state, and the time that the download was/will be available (ie, requested time + 30 seconds).
Whatever you use to do the download looks up the ID and determines whether it should send the file or not. If not, show a warning or redirect to the ad or whatever.
Whatever you use to do the download looks up the ID and determines whether it should send the file or not. If not, show a warning or redirect to the ad or whatever.