How do I add scores to my website database?

0 favourites
  • 7 posts
From the Asset Store
Basic Plugins for Firebase Authentication, Realtime-Database, Firestore, Cloud Storage
  • I am creating a new game that will be available for Android and my website.

    At my website, you need to register and login to play the current game, and now I want to do the same with my C2 games. I need to identify the users and add the score to their current points at the website.

    I readed the tutorial about the simple login using MySQL, but I also seen in other posts that this can be very unsafe, and we can add a login using cookies or session state and AJAX, (server can tell from your session/cookie what is your state). However, I don´t know how to start to build a connection with cookies and AJAX.

    Any help?

    Thank you!

  • updating the code in the tutorial from mysql to PDO prepared statements helps reduce mysql injections.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • maxxscape Where can I find a tutorial for this? I´m not a developer and I need some 'extra' help to make the connection.

  • https://www.scirra.com/tutorials/346/on ... -php-mysql

    This is a video tutorial that will walk you thru - step by step.

    It does not use PDO prepared statements but it does work...

    There are some things you could add to it like checking for the user IP address that would help prevent someone from submitting the same score twice.

    Also, if you wanted, you could check the current top 10 high scores and if the current high score is lower than the lowest of the top 10, don't addict.... This would keep your list from growing...

    It does use mysql tables so you would need your own server and the knowledge and capability of adding the database and tables, assigning rights and setting up the connection to the database...

  • We are doing an MMO using Construct as the front-end client. The back-end database is accessed using a Java JDBC driver via Java servlets. You could just as easily use PHP or Perl to do the same thing though. I would look into Java, PHP, or Perl database connections. These programs can then interface with your Construct via HTTP.

  • maxxscape Thank you, I´ll take a look and see if I can do it.

  • gumshoe2029

    Right - and php / mysql is what the tutorial shows... The code should be updated for PDO because when PHP 6 comes out, a LOT of older code won't work - in fact nowadays, if you use older code and don't suppress errors, you will get feedback saying this or that has been deprecated, or will be soon... So it pays to stay ahead of the 'game'.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)