Using a MySQL database for plugins

Discussion in 'Plugin Development' started by HeyAwesomePeople, Oct 30, 2013.

Thread Status:
Not open for further replies.
  1. Hello

    I know how to use a MySQL database in the actual code, but what if I wanted to use a private one. Like say I create a plugin where I get players inventory and store them on a website for people to view. How would I hide the password/username/host so that people cannot de-compile my plugin and have access to that info?

    Thanks,
    HeyAwesomePeople
     
  2. Offline

    zachoooo

    You just store it in a config file. Don't hard code it.
     
  3. Yes.. Maybe. But I want the plugin I am making to be able to be on other servers and access the same MySQL database, without people being able to decompile the plugin and get the info.

    Like if I created a plugin called "OnlineInventory" and all it did was store a LIVE players inventory online, I would have to(well need to for performance) use MySQL. Now I don't want any old person to know the info to the database if they decompile the plugin. How would I hide it?
     
  4. Offline

    zachoooo

    You don't want people directly accessing your database at all in this case. Have clients send data packets which are then processed by your web server. The web server interfaces with the client and the MySQL Server.
     
  5. Offline

    frostalf

    as zachoooo has stated, use a config file instead of hardcoding. Which means implement a method to make a config.yml in the plugins folder. Manually edit the config.yml with your DB's credentials. Everytime your plugin needs to connect, it pulls the credentials you specified manually in the config.yml. This plugin can be on other servers that you have access to however its not recommended to have it run on servers you can't control, because then everyone will have your credentials. Its like a website, do you allow everyone to see the configs of your website? Most likely no because then everyone knows all the sensitive information.
     
Thread Status:
Not open for further replies.

Share This Page