Jump to content

Archived

This topic is now archived and is closed to further replies.

Riotblade

Downloads limitted by time?

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.