How to securely pre-sell MP3's
August 14, 2006 5:49 PM
Subscribe
How to pre-sell MP3's and allow access to buyer via a password system?
I am wanting to sell an album of MP3's which I will have stored on my server.
I want the ability for the musician to be able to "sell" the album at live shows, whereby they give the buyer a postcard with the web address and an access code to download the music.
I want to be able to create a list of different access codes/passwords (for multiple buyers), and have each pasword/code expire after the first login to avoid multiple downloads.
Is there a way that I can do this?
posted by mule to computers & internet (9 comments total)
1 user marked this as a favorite
Step 1) Generate access codes. In PHP you can md5() a random number to create an access code (use substr if you want one with fewer than 32 characters).
Step 2) Store the access code in a database, maybe in a table with columns "album_id, code, [boolean] downloaded".
Step 3) When the user logs in, seach the database for a matching code where 'downloaded' = false. Allow the user to download the matching album_id and set 'downloaded' to true.
posted by null terminated at 6:10 PM on August 14, 2006