2

I'm trying to make my cordova game send/receive data to an online database. Such as being able to see everyone's high score. Even more deep, I would like to also maybe add a very simple multiplayer online.

I've looked into node.js but it doesn't seem like it's my sort of thing currently. Plus it's a bit expensive to have it up and running. And I'm really more looking for a database rather interactivity for now.

I've been looking into PHP/MySQL but it seems the security might be pretty bad on it if I have researched correctly.

Basically, all I really want to do is for the cordova game to:

1) Send Data to www.mywebsite.com (website belongs to me)

2) www.mywebsite.com stores data

3) www.mywebsite.com sends data to every app owner

4) App receives www.mywebsite.com data

5) App Display data

If this makes sense. And of course, as securely as possible. I'm thinking maybe every user gets assigned a 32 character passcode or something.

I've been able to successfully make a single player app and publish it. And am trying to move slowly into the online process, but I am a bit confused and have no idea where to start.

Thank you for your help

tery.blargh
  • 405
  • 1
  • 6
  • 23
  • Check out firebase: https://www.firebase.com/blog/2013-04-16-firebase-adds-phonegap-cordova-support.html – Blue Apr 16 '16 at 09:13

1 Answers1

1

If you're a beginner to the online process, PHP/MYSQL would be a preferable option. Make sure you have a hosting plan and then consider using a PHP framework that will handle the details concerning best practices for security. CodeIgniter might be one place to start since they have very good documentation and the whole framework is quite simple to follow visit https://www.codeigniter.com/. Use that to create an API that will handle the ranking for the multiplayer game and also sending of data to the app. If its a cordova game you can use device id to uniquely identify each user in your database for example in your javascript it could be something like this

var device = $cordovaDevice.getDevice();
var manufacturer = device.manufacturer;
var model = device.model;
var uuid = device.uuid;//use this unique identifier

Do let me know if you need help on specifics. Good luck!

  • This is very useful! Thank you very much. The unique identifiers was exactly what I was looking for too! I am currently learning php/mysql and I am certain you put me on the right path :) – tery.blargh Apr 17 '16 at 04:12
  • Although the UUID is very useful, can't it be faked? Is there a way to possible confirm it? I don't think the database will be able to distinguish between an uuid and a random generated set of characters – tery.blargh Apr 19 '16 at 00:31
  • There are ways to do that but I think it may be overkill for a game don't you think? Anyway check out this post http://stackoverflow.com/questions/7905929/how-to-test-valid-uuid-guid – Lionel Arucy Apr 21 '16 at 07:02