Jump to content


Photo

Downloads limitted by time?


  • Please log in to reply
1 reply to this topic

#1 Riotblade

Riotblade
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 27 May 2006 - 04:38 AM

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

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 27 May 2006 - 09:08 AM

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
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users