Small job offering connect to MySQL database

Hello,
I am offering 50 euro for the person that can create an in debt tutorial on YouTube made for dummies to setup a connection between Godot and a MySQL database on a simple website. It must be protected against database injection.

There is a tutorial, but for firebase and I have my own website, so no need for me to pay Google more.
What I want to learn is how to create all the scripts on the hosting and connecting it to the MySQL and I want to know how the scripts look like in Godot (so the whole process).
What I need it for is to send several variables as a json dictionary to a MySQL database that I have created. And I want to sync the data back to Godot.
Like sending the highscore and some strings to the database and when the user plays the game again, to directly updata the score and settings from the MyQSL.

Comments

  • BinskBinsk Posts: 43Member

    I might consider doing this for you if I have the time this week (never made a video tutorial before, however, but I have written an online highscore system).

    However, before you bother offering cash I'm sure we could always just help you out in the programming section.

    You said you already have a server so have you written any code where your server talks to your database? If so, all you need to do is literally add the step of Godot talking to your server and then let the server pass it on to the database.

    If you know PHP (and MySQL, of course) then you're good to go.

    Again, this is working off the assumption you have designed even a very simplistic website on your server but the steps are like this:

    1. Make a .php page on your server that takes in POST requests, parses the data, and talks to your database. Assume anything echoed from this page will be received by Godot (including, for example, a JSON response). If you are using something like PDO (a standard class in PHP) for your MySQL requests then most SQL injection is already taken care of.

    2. In your Godot project simply use an HTTPRequest to send a POST message to that page on your server. The server then responds by echoing whatever it needs to which is then received by Godot. Godot has a built-in JSON parser that can go from Dictionary to String and back so that makes that portion trivial.

    That's about it. For something like highscores you'll want some extra security like nonce checks to help prevent cheating (something easily implemented), a security hash (again, something easily implemented), and, if you plan on hosting your Godot game online somewhere other than your server (such is Newgrounds, Miniclip, Itch.IO, or a number of others) you'll need to have some pre-flight check code in your PHP (again, a couple lines of code).

    I realize all this waffling above is uninvited so if you still want a video I'll think about making a simple walkthrough for this but otherwise I'd be glad to answer questions if you ask them in the Programming subforum.

    NOTE: I am not an expert in this area, but I have over 15 years experience towards programming in general and have learned all the above just researching on my own.

  • DanielCDanielC Posts: 67Member

    Hello Binsk,
    Thank you for replying. Unfortunatly I know nothing about php programming. All I can do is create a MySQL database from the settings panel in the hosting. So I am really a noob in this area (I only know some html and how to copy paste php script samples).
    I managed to create a nice educational program in Godot, but this is the last missing step. So I would be really glad if you could create this tutorial. If you can't make it on video, you can just write it down with some screenshots and I will make a video out of it. I think it is important for all Godot users to get this information with ease.

  • DanielCDanielC Posts: 67Member
    edited November 16

    You can contact me through my website: www.iqsted.com
    I also have another thing with broken code, so your help would be really great!

  • HideousKojimaHideousKojima Posts: 1Member
    edited November 17

    Would this need to be in GDScript, or would C# be fine? I can probably get something together in GDScript but C# is my preference.

    EDIT: Also would you prefer it to be with raw SQL, or would an ORM like Entity Framework or Dapper be fine for you?

  • DanielCDanielC Posts: 67Member

    For this tutorial both languages can be used. Like first the script in GDScript and afterwards in C#. I don't use C#, only GDScript, but others might want to see the code in C#.

    I haven't heard anything from Binsk since the last post. So I don't know if Binsk is working on it or not...

  • BinskBinsk Posts: 43Member

    If HideousKojima is willing do take on the job, go for it.

    I'd only be able to get to it if I finish work for a couple clients early this week. I have not started anything as of yet.

  • DanielCDanielC Posts: 67Member

    OK, if you have too much work this week, then maybe HideousKojima kan help. By the way it needs to be in MySQL (the standard that comes with all webhosting platforms.

  • GrampsGramps Posts: 42Member

    You want someone to make write the code or create a tutorial about writing the code?

  • DanielCDanielC Posts: 67Member

    I want it both. A tutorial for writing the code to send variables to an MySQL database. It needs to include the php on the website and the GDScript (and if possible also C#) for Godot. Also how to connect the PHP with the database. I need it myself, but want all other Godot users also to learn how to do these things.

  • DanielCDanielC Posts: 67Member

    Still nobody actually told me that he/she is starting with this tutorial? Who will do it?

  • DanielCDanielC Posts: 67Member

    Binsk?

  • BinskBinsk Posts: 43Member
    edited November 20

    @DanielC

    If no one is taking up the job then I'll go ahead and take it on. Next week is Thanksgiving (I'm in the USA) and I will be with family so my estimated date of completion will be a week from this coming Tuesday at the earliest, two weeks from Tuesday at the latest.

    As I understand it this is what the video will be:

    • A video walkthrough demonstrating full setup / programming required to make a basic online highscore system that takes a name and score
    • Data from / to Godot should be a JSON dictionary
    • Should cover all three languages required for implementation including GDScript, PHP, and MySQL
    • Should handle basic security (such as nonces, hashing, etc)
    • Should support cross-domain traffic (so pre-flight checks)
    • Assumes user has a server (local or otherwise) set up already w/ a functional MySQL database.

    The aspects covered for a highscore table can be expanded to user account data and the like if the underlying concepts are understood. I can only guarantee a basic functional implementation that is secure on a basic level.

    As a note, I do not use nor support Youtube. I will host the video on Bitchute and send a link. You will have permission to re-upload to youtube on your own if you wish (without monetization).

    If this sounds good to you then I accept the job. If you need to contact me further you can do so at binsk@disroot.org.

    For payment, if you have PayPal that would be ideal (or crypto, if that's your thing), I'm fine doing a gentleman's agreement and taking payment (or sending an invoice, if you prefer) after I have finished the video.

    Let me know your thoughts and if you confirm. All the best.

  • DanielCDanielC Posts: 67Member

    Great, thank you Binsk! I will send you an email. Never heard about Bitchute. I will check it out.

Sign In or Register to comment.