Jump to content

changing a download link every 5 minutes?


L

Recommended Posts

So basically you want help figuring out how to make the links expire?

 

Make a table in the database like this

 

TABLE links
-----------
linkID - Auto-increment, primary key
key - this will be a unique ID for the url generated by the function uniqid()
time_created - the time the link was created

 

Now have your links look something like this

www.domain.com/download.php?key=121w21e

 

When the user clicks on that link, you need to check the database to check if there is a link that exists with that key and is less than 5 minutes old.

 

Hopefully you get the idea. Just let me know if you need more explaining on something.

So basically you want help figuring out how to make the links expire?

 

Make a table in the database like this

 

TABLE links
-----------
linkID - Auto-increment, primary key
key - this will be a unique ID for the url generated by the function uniqid()
time_created - the time the link was created

 

Now have your links look something like this

www.domain.com/download.php?key=121w21e

 

When the user clicks on that link, you need to check the database to check if there is a link that exists with that key and is less than 5 minutes old.

 

Hopefully you get the idea. Just let me know if you need more explaining on something.

 

using db is much complicated

i think session can do that

 

something like set an index for session that will contain the time etc..

then once he click the lick pass it to other page that will check if the session is set and its within the tme then if its ok redirect them on the right path

 

 

like above, create a download links table, then create a cronjob, change the download link every 5 minutes, or change ti automatically when they download and update the sql table and rename the file, boom simple :).

what if i access the page during my first minute and it change the link  ???

So basically you want help figuring out how to make the links expire?

 

Make a table in the database like this

 

TABLE links
-----------
linkID - Auto-increment, primary key
key - this will be a unique ID for the url generated by the function uniqid()
time_created - the time the link was created

 

Now have your links look something like this

www.domain.com/download.php?key=121w21e

 

When the user clicks on that link, you need to check the database to check if there is a link that exists with that key and is less than 5 minutes old.

 

Hopefully you get the idea. Just let me know if you need more explaining on something.

 

using db is much complicated

i think session can do that

 

something like set an index for session that will contain the time etc..

then once he click the lick pass it to other page that will check if the session is set and its within the tme then if its ok redirect them on the right path

 

 

 

don't really like your algorithm, I think my way was more polished idea of doing it.

like above, create a download links table, then create a cronjob, change the download link every 5 minutes, or change ti automatically when they download and update the sql table and rename the file, boom simple :).

what if i access the page during my first minute and it change the link  ???

 

you can put a start time in the db using the time(), then just subtract 5 minutes  from the current db time and check if its greater or less then the last 5 minutes, if it was then rename it, pretty simple...  shit you don't even have to do that, just let the cron job do its job..and password protect the directory..

The reason I was avoiding sessions was that if they closed the browser, the session would be lost and there goes the download link. I guess they could set a cookie, although I'm not quite sure how secure that would be.

 

like above, create a download links table, then create a cronjob, change the download link every 5 minutes, or change ti automatically when they download and update the sql table and rename the file, boom simple Smiley.

 

Why change the download link? Just have the link become inactive after 5 minutes, no need to change it. Then the cron job can come through and delete all the entries that are 5 minutes+ old. They wouldn't even have to run the cron every 5 minutes, they could code the page to just give an error if it is more than 5 minutes old.

like above, create a download links table, then create a cronjob, change the download link every 5 minutes, or change ti automatically when they download and update the sql table and rename the file, boom simple :).

what if i access the page during my first minute and it change the link  ???

 

you can put a start time in the db using the time(), then just subtract 5 minutes  from the current db time and check if its greater or less then the last 5 minutes, if it was then rename it, pretty simple...  shit you don't even have to do that, just let the cron job do its job..and password protect the directory..

 

dont act like you always have good idea ??? this is forum men all  idea  is welcome

i remember when thorpe comment on my answer and i just said im not gonna do that but i did i use thorpes idea on one of my validation

;)

Archived

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

×
×
  • 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.