This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
DannySMc's profile picture

Shared Databases

Started by DannySMc, 09 January 2015 - 08:29 AM
DannySMc #1
Posted 09 January 2015 - 09:29 AM
Hi everyone,

Recently I have seen a grow in topics based upon standardising a set of protocols. So I thought I might try and offer some assistance.

I have a web server with a few php scripts that I use for my program, especially self-updating programs, so I wouldn't mind making a database that we can all use, and set it up so we are able to have multiple tables, that can be accessed, my server is never down, in one way I have had it for 2 years and it has never gone down once! Only if I am upgrading and that doesn't affect the actual server, just more the content on the dynamic pages.

So here is what I propose, let me set up a PHP script (or two) that allow users to access say an open system that everyone can use.

Example:
We have a user table that stores:
+ UserID
+ Username
+ Password (sha256 hashed)
+ Email Address
+ Recovery Code
+ Group

Now an API allows users to access different parts of the 1 php script, for example, the API, when posting data will specify a system type (email client, users table, etc.)

The API will be like (for user database):
ccdb.user.login(username, password)
ccdb.user.register(username, password, Email Address)
ccdb.user.delete(username, password)
ccdb.user.recover(username)
ccdb.user.view(username, password)
ccdb.user.group(username, password)

The login of course will allow you to login, giving you a boolean: true or false on whether you exist or not.
The register will allow you to add yourself to the database.
The delete will allow you to delete your own account.
The recover option is the best one but when a valid email address is supplied, the PHP script will generate a random hash, this in turn will be saved to the Recovery Code field in the users table, then an email will be sent out that will give you that script. You use the email instead of a password and you get the option to change your password.
The view will return all your data that is stored.
The group option is a new one that will allow people to give users a group, of course this should be a checksummed value so no one else can get the same group, this can be used in your programs for checking what type of permission you are etc.

All these options have to be supplied a password so no one can get into your data.

Of course these are changable and options can be added just please tell me your ideas and let me implement them as I would love to host the database as I work with PHP in my job.

Another thing is we shall make a web version for users that can't get to a ComputerCraft emulator or minecraft.

Anyway, please post your ideas as if we all follow the same rules, it means we can all share a database instead of having to register for each program!

Any more in-depth questions PM me.
safetyscissors #2
Posted 09 January 2015 - 11:31 AM
Small talk
Able and willing to help. Using a specific framework?

Specific Suggestions Sorry if you've already considered them.
Spoilerlogin
-Dont roll your own login. Email and habitual reuse of passwords makes this dangerous.
-Hash email if its only for recovery. request it when resetting
-Just email a hash password.email.day.salt to recover. Shouldnt change the password or use another field.
data
-Encode data with user.pass.salt please
-Define a data cap and expiry date based on unuse.
-Option to limit data scope by server.
I am concerned people would hardcode user/password/email in code on smp computers and released programs.

Moving forward
Elements of this is very exciting. I would love to see it more specialized.
Is this heading toward a global value:pair database? Or toward a private pastebin?
Might be nice to hide the how and organize a proposed list of actions for the lua api, user's web ux, and admin's web ux.
Consider a sandbox. A prototype we can play with now, and a tool to improve workflow and hook future users.