...

View Full Version : Links that expire



blackwolf
10-30-2008, 02:23 PM
I will be putting PDF files on my server and I want to link each one through my site so when a user clicks their link, they start downloading the file. This part I can do.

The hard part for me is getting these links to expire 7 days after upload or after the user has downloaded it once.

Any ideas. I know PHP is used.

jerry62704
10-30-2008, 02:52 PM
Either set a cookie on their machine, knowing they might just delete it, or have them log in to your system using PHP (or whatever you have) and set the time there. Then you just have them log in and check the date. You might want to ask this in the PHP forum.

zfred09
10-31-2008, 04:22 AM
Don't use cookies unless you don't really care about really making these links inactive. In a MySQL database simply store a upload time and then use another column to store whether the link is active or not, ie 1 or 0 or whatever.

Then when you pull these links out of the database to display them to the user, use a WHERE clause in your sql query that selects only active links. Depending on your application you will need to check the time also and update the active field accordingly.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum