WordPress.org

Ready to get started?Download WordPress

Forums

Creating expiring download links? (2 posts)

  1. Haloscope
    Member
    Posted 2 years ago #

    Hello,
    I'm working on a plugin that would benefit from a system that allows WordPress to create temporary links to downloads that would expire after a short time. I couldn't find any plugins on point, so I'll be writing one. However, I would prefer not to reinvent the wheel.
    I figure it would incorporate a few different elements:

    1. Create redirecting link to the real download location
    2. Destroy that redirecting link to the real download location after a user specified time

    Have you done either of these things? How would you suggest doing so?
    I would appreciate any assistance you may have or directions you could point me in.

    Regards

  2. digibucc
    Member
    Posted 2 years ago #

    i would start with this:

    Google URL shortener API

    have that create the link.

    for the expiration, it's not something i have ever done. my first thought would be a table in your db, that gets an entry every time a link is created, with a time. then a cron script could run every hour and delete entries older than "x" time.

    it may be possible to have a script that checks the db before opening the link. if it's a file on your site, you could probably edit htaccess to run a script that checks the url and when it was created before allowing a download. idk that either, but it sounds good :)

Topic Closed

This topic has been closed to new replies.

About this Topic