Jump to content

Only allow members who have paid w/ tokens to download


mike12255

Recommended Posts

Im creating a token system where if a user uploads notes they get tokens and can download other peoples notes. My problem is I am not sure where to store the information for who has bought the note for future download. Should I store the information in the database under the table that looks after the notes, in its own table, or in a file that has arrays of the Note names and the users who are allowed to download it.

 

I figured the best way would to have it in the db table that looks after the users but im not sure how I would get about making it so that every time the user bought another note I didnt have to add a new field.

yes I understand that part and actually have it working right now. My issue is say the user loses the note, I want them to be able to visit their profile and redownload and previously purchased notes. However Im not sure how to go about storing the information that they have purchased note X.

ah... i see.

 

You could have a "users_downloaded" table. Could simply start by having two fields, user ID and downloaded_note.

 

Then if the user downloads the note and loses it, you only have to search the above table and return all the users notes... you could add more info of course like where they got it from date added...etc

____________________

 

 

Otherwise you would have to create a mapping system for each note added:

 

The notes table has userID, noteNumber, note.

 

Then when user '789' downloads note '17' from user '123', you only need to store 17 and 123 instead of the whole note.

 

Archived

This topic is now archived and is closed to further replies.

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