Jump to content

Downloads limitted by time?


Riotblade

Recommended Posts

I've searched all over google for an idea on how this works.

I'm trying to setup a page where people can only download a file every 20 seconds or so. The download is called from a function which checks if they have downloaded anything within the past 20 seconds.

My idea is to get their ip address and insert it into a db with the date/time.

What's puzzling me is how I can check and update the database every ten seconds. I was thinking of using a cron job but the lowest it can go to is minutes.

I want to hear the opinions of skilled programmers on how to do this the most efficient way.

Thanks
Link to comment
Share on other sites

Well what i would do is store the file as BLOB in a table therefore no one can hotlink it for a start..
You don't need to run anything that auto checks the db every 20secs as all you need to do is have another table which stores the IPaddtess and datatime stamp.
Then when a user accesses the website you check the table to see if that userIP has accessed the database in the past 20secs.
Your download page will basicaly be a php script which checks the database for when the user last downloaded and if success then it will sent the header and files content to the page therefore popping up a download for the file :)

I would give you an example but i wrote it and now can't access it.. think work may have caught up with my last year of breaking the AUP lol


Regards
Liam
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.