Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2008
    Thanked 0 Times in 0 Posts

    Links that expire

    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.

  • #2
    Senior Coder jerry62704's Avatar
    Join Date
    Oct 2007
    Springfield, IL
    Thanked 87 Times in 87 Posts
    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.
    ...and gladly would he learn and gladly teach

    Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls

  • #3
    New Coder zfred09's Avatar
    Join Date
    Dec 2006
    Thanked 5 Times in 5 Posts
    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.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts