emorjon2 0 Newbie Poster

Hi all!

I am developing a java-game where you are building with balls. It will connect to a server to create a huge map available for everybody playing this game.:)

For this, I need a PHP-file who will append some urldata into the file data.txt, for adding a ball into the server map.

But when I run this file for testing, something very stranged happend. I can't explain it, but I must fix it if i want to be done with my game.:S

the PHP file is called addball.php and the url goes like this:

http://localhost/ballania/addball.php?ball=11x10x1x0x0

the data I want to transport to see if it work is

11x10x1x0x0

But when the PHP file appended it to the data file, the file goes from empty into this

11

I tried to add some code the urldata goes from this in the URL

11o10o1o0o0

to this in the file:

11x10x1x0x0

but still, it would be this:

11

:yawn:

heres the code for it. I don't know what code does manipulate the data but I hope that
you guys would found it.

if (isset($_REQUEST["ball"])){
	 $fname = "data.txt";
	 echo $_REQUEST["ball"];
	 $f = fopen($fname, "a");
	 $filedata = str_replace("o", "x", $_REQUEST["ball"]);
	 echo $filedata;
         //here it starts to go something wrong
	 fwrite($f, str_replace("o", "x", $_REQUEST["ball"]) + "_");
	 fclose($f);
}

PLEEEEEEEEEEEAAAAAAAAAAAAASE can someone help me?????? :'( I will be SOOOOOOOOO happy
for answers!

PS. If there's any bad english in here, I'm sorry. I'm swedish

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.