Note: Scirra is not responsible for the content. The drawing is community made so if it becomes offensive to anyone report it and I will clear the database content
Loading the world
Basically when you click 'load' it downloads a webpage that contains all the lines.
http://steamgauge.com/misc/construct/da ... wnload.php
As you can see if you download it in a web browser, its a bunch of numbers which wont mean much to you. However, to the application, each line represents an object in the form:
X, Y, Width, Angle, Colour
Saving the world
Saving is a bit more complicated. Basically it generates a url in this form:
The php script can obtain X as a string like this: "1,2,3,4,5" and then split it into an array using the commas.
This is really just a proof of concept, but something like this could be used for something much bigger. For example, you could have a login system which stores all the usernames in an SQL server, and then you use the download object like this:
And then compare what the website returns.
However, there are many things to consider with this approach.
1 - A hacker might be able to trick the computer into sending the 'logged in' message back without ever contacting your server
2 - Any url you send could be viewed by hackers potentially, so the data should be encrypted somehow
The advantage to using php to communicate with the database is that you dont have to worry about the username and password to the database being stored locally on everyones computer
Later I'll provide edited (so people dont know the password to the database ) versions of the php scripts I used for upload and download.