Jump to content

Recommended Posts

I am currently hosted on lunarpages.com

What I want to do is sell mp3's of local artists.  I only want people to be allowed to download the mp3 if they purchase it.

 

Is there a best practice method of restricting access to a file, and then allow access only if someone purchases the mp3.  Using a url key or something?

 

How is this done?

I have not looked into this too much, but here is an example download script:

 

http://www.zubrag.com/scripts/download.php

 

You would use something like that to dish the file. What I would do is if the user bought it, you create a hash in your database for that user which points to the file they bought. Have the hash expire after 24 hours or something similar or require them to be logged in to access it. Then when they call download.php?file=hashcreated  you would look up that hash, verify the user then dish out the file. If they are not a valid user or the hash is invalid then you do not deliver the file.

 

You would use a CRON job to clean up the database of hashes older than x amount of time to prevent them from continually leeching/giving it away to someone else.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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