L Posted November 7, 2007 Share Posted November 7, 2007 Hey, I am hosting files that can be downloadable, but I don't want sites leached off of them so can the URL to the download expire after 5 minutes? I really clueless here ???, help appreciated Thank you! ~L Quote Link to comment Share on other sites More sharing options...
Daukan Posted November 7, 2007 Share Posted November 7, 2007 you could change the filename and update the link Quote Link to comment Share on other sites More sharing options...
L Posted November 7, 2007 Author Share Posted November 7, 2007 Yah, but that would require lots of time...i thought I could do some magic with php Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 7, 2007 Share Posted November 7, 2007 ignore Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 7, 2007 Share Posted November 7, 2007 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. Quote Link to comment Share on other sites More sharing options...
Demonic Posted November 7, 2007 Share Posted November 7, 2007 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 . Quote Link to comment Share on other sites More sharing options...
L Posted November 7, 2007 Author Share Posted November 7, 2007 Alright thanx guys. I'm going have to look up stuff about cron jobs then before I get started...I'll refer to this thread if I have any problems. Thanx again, ~L Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 7, 2007 Share Posted November 7, 2007 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 Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 7, 2007 Share Posted November 7, 2007 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 ??? Quote Link to comment Share on other sites More sharing options...
Demonic Posted November 7, 2007 Share Posted November 7, 2007 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. Quote Link to comment Share on other sites More sharing options...
Demonic Posted November 7, 2007 Share Posted November 7, 2007 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.. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 7, 2007 Share Posted November 7, 2007 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. Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 7, 2007 Share Posted November 7, 2007 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 Quote Link to comment Share on other sites More sharing options...
L Posted November 14, 2007 Author Share Posted November 14, 2007 Well I got my cron job knowledge down...but the database thing is confusing me... pocobueno said that it would delete whatever is 5 minutes old from the database, which I good, but how would I put new links back in for the same files? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.