this is a simple setup to collect some data and store it as JSON in a txt-file on a server.
Makes use of jquery to access a small php-script which writes the file … and should give you a good start.
Usecase: e.g. store playerdata of a hypegame
permissions: php should be 644, filesdirectory should be 766 (for testing you may use 777)
yes, it´s working - thank you.
question - it places per new user each a new text file. is it possible to enter a new user with a new score in the same text- file ?
I put this on ISP server space ( public_html) in a directory. The myFiles directory remains 0755 , even when I change it it reverts back. But it does seem to work with now problem.
Three things.
1,I am curious though is there any risks having a writable php and what not on the server and is there anything I need to do to make sure I stay secure.
2, I assume the 0755 is so the world can access the folder and in the case of a directory execute means open.
Think I found how to initially read the file back from the server.
In a new function call by a button action:
var currFileName = hypeDocument.getElementById('fileName').value + '.txt';
var full = "myFiles/" + currFileName;
$.getJSON(full, function(data) {
console.log(data);
}).fail(function() {
console.log("Something went wrong with the request!");
});