How do I add scores to my website database?

Get help using Construct 2

Post » Fri Nov 14, 2014 1:29 pm

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!
B
6
S
1
Posts: 22
Reputation: 483

Post » Fri Nov 14, 2014 2:55 pm

updating the code in the tutorial from mysql to PDO prepared statements helps reduce mysql injections.
B
11
S
2
Posts: 46
Reputation: 739

Post » Mon Nov 17, 2014 2:53 pm

@maxxscape Where can I find a tutorial for this? I´m not a developer and I need some 'extra' help to make the connection.
B
6
S
1
Posts: 22
Reputation: 483

Post » Mon Nov 17, 2014 4:35 pm

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...
B
11
S
2
Posts: 46
Reputation: 739

Post » Mon Nov 17, 2014 4:36 pm

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.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Tue Nov 18, 2014 8:17 am

@maxxscape Thank you, I´ll take a look and see if I can do it.
B
6
S
1
Posts: 22
Reputation: 483

Post » Tue Nov 18, 2014 9:25 pm

@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'.
B
11
S
2
Posts: 46
Reputation: 739


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 56 guests