View Full Version : flash save multiple account info to text on server?
xxj4dx
06-21-2007, 11:33 PM
ok :D how would you go about saving info for more than one user on a text file on a server, andof course being able to acsess it again...:rolleyes:
id really apriciat he help...:)
xxj4dx
06-21-2007, 11:36 PM
this is for a rpg game, http://www.gojonny.com/End%20of%20ages%20top.swf
inhan
06-21-2007, 11:51 PM
Are you fammiliar with script languages like PHP and/or ASP?
xxj4dx
06-23-2007, 10:12 PM
unfortunetly no,:confused: but i have basic knoladge of php:rolleyes:
xxj4dx
06-23-2007, 10:14 PM
very basic:eek:
inhan
06-24-2007, 04:06 AM
I can assist you on the basic way of writing data on a text file (via PHP). You know the Flash-side? The LoadVars issue..?
xxj4dx
06-25-2007, 06:02 PM
yes i can do the flash part:cool: , anyways if you can help with php that would be awesome, ... i ran across a tutorial awhile back with something like my original question, it saved data (users & pws) and read them( logging in) but it wouldent update more data...:rolleyes: like species,money stuff like that. if you can understand the php to make it alow that, it would be great!:)
ty for your attention so far!;)
xxj4dx
06-25-2007, 06:12 PM
http://www.flashkit.com/movies/Interfaces/Forms/Username-neonWhis-5762/index.php that was it it is what i am using, just i cant make the phpp alow stuff other tha the user and pw, then load it again:confused:
xxj4dx
06-25-2007, 06:15 PM
ooops... no thats wrong tut, that was with cgi...:eek:
inhan
06-25-2007, 08:36 PM
Can you give me an example of the output (the data in the text file)?
inhan
06-25-2007, 09:15 PM
Nevermind my question. Once you gathered and edited the data in flash, send it to the php with LoadVars.send(AndLoad).
And in the php file...
<?php
if ($_POST) {
// this is to ensure that opening this file alone won't reset
// all the data in the text file.
$infos = $_POST['infos'];
// this gathers the data within "LoadVars.infos"
$fileName = "someFile.txt";
// add ../ prior if you wanna refer to the parent dir
// or for the otherwise... someFolder/someFile.txt
$file = fopen($fileName, "w");
// "w" mode overwrites if it is already present
$write = fwrite($file, $infos);
// this will return a boolean depending on its success
if ($write) {
echo "&success=ok&";
/* in the returnVars you will be checking it like
returnLV.onLoad = function(loaded:Boolean) {
if (!loaded) {
trace("file not loaded");
return;
}
trace("file loaded");
trace(this.success == "ok" ? "successful" : "there has been a problem");
};
*/
} else {
echo "&success=problem&";
}
fclose($file);
// finally close the file.
} else {
echo "this file is not meant to work alone!";
}
?>
xxj4dx
06-25-2007, 11:02 PM
[QUOTE=xxj4dx;622716]... how would you go about saving info for more than one user... QUOTE]
thank you very much for the code.. but um as said there/\/\/\
dose that get it for diferent users?
xxj4dx
06-25-2007, 11:12 PM
also is that part of a tut,:) if so do you have a link;)
inhan
06-25-2007, 11:43 PM
Nope, I wrote this.
About how to change the data.. Once you get the value from the txt file, you can change it to anything and send it back to the php. But how you're determining the values, which variables refer to what... it all depends on all of these criteria...
But basically, you get all the data, change some parts of it (or add it) and send this whole to the php.
xxj4dx
06-25-2007, 11:53 PM
cool, ....:rolleyes:
soooo would the text file lok like this;)
user=xxj4dx&species=goblin&money=100;
user=bob&species=goblin&money=100;
ect...
then would php be able to get the data depenging on the username?
:confused:
inhan
06-26-2007, 12:15 AM
You can also send the data to the php as an array but because a text file is the most basic form of text, it will probably be something like
user1=xxj4dx&species=goblin&money=100&user2=bob&species=goblin&money=100
and you will be changing some part of it in flash and sending it all back to the php. Though using an xml for that would be much beneficial.
xxj4dx
06-26-2007, 12:32 AM
but....:eek:
how does flash know who user 2 is with out first asking php:confused:
xxj4dx
06-26-2007, 12:36 AM
hey if you have time can you tak in the in game chat room because it like takes a while for respones
inhan
06-26-2007, 12:44 AM
There are many ways to do that. But in either case using an xml would be a much better solution.
EDIT: I'd been working in the last 40 something hrs, so I'm a bit exhausted. I'll be able to help tomorrow I guess, sorry...
xxj4dx
06-26-2007, 12:54 AM
k later...
ps: the reson i havent thout of xml b4 is because i am... well....
not good at xml...
like really....
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.