PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
My friends band have asked me if I would be able to put MP3s up for download on their website which will only be accessible by entering a unique download code. I'm currently trying to learn some php & mysql and was wondering if someone could point me in the right direction about how I would go about this or if it would be completely out of my depth.
The idea is that they are going on a small tour and want to give away tracks to those who turn up to the shows. Each person would be given a sleeve or flyer with a download code which will allow them to download the track once only.
bascially u will make 1 table wit h3 fields. u have 1 feild for the code, 1 for a Y or N and then u put the mp3's in to one location. then in the last feild u put the location relitave to the script. so when you cal lit by select,you select the code form the db if it exists,fetch the array,if the Y/N field is equal to N,append the location to the url and it should download.
via aol and spelling translation, a94060 wrote:bascially you will make 1 table with 3 fields. you have 1 field for the code, 1 for a Y or N and then you put the mp3's in to one location. then in the last field you put the location relitave to the script. So when you call it by select, you select the code form the db if it exists, fetch the array, if the Y/N field is equal to N, append the location to the url and it should download.
You could get even simpler. Just have a database with valid codes & the file for the code. Once the download has been started, remove the code from the database.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
via aol and spelling translation, a94060 wrote:bascially you will make 1 table with 3 fields. you have 1 field for the code, 1 for a Y or N and then you put the mp3's in to one location. then in the last field you put the location relitave to the script. So when you call it by select, you select the code form the db if it exists, fetch the array, if the Y/N field is equal to N, append the location to the url and it should download.
thank you for blowing me off like that. i did not know how to store files into the Database so i could not speak for that.
I think he was referring to your use of 'aolspeak' as opposed to proper english words. What you said was certainly valid, it was just cryptically written
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Create a login/register system, and once they select a file for download, store user info in a database table with already downloaded mp3info. Welcome to coding PHP. Hey if you can't build it, tell that band I'm looking for a freelance job.
Store all the codes + references to specific file in the database... And when someone uses it, simply remove it.
This way you always know who's still allowed...
(If you want to keep some history for some reason, instead of deleting it, move it to a 'used_codes' table)