# Fwrite problem

**URL:** <https://forum.kirupa.com/t/fwrite-problem/136915>\
**Category:** Uncategorized\
**Created:** [February 9, 2005, 12:54pm UTC](https://forum.kirupa.com/t/fwrite-problem/136915 "2005-02-09T12:54:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![A7RSTR7K3](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@A7RSTR7K3](https://forum.kirupa.com/u/A7RSTR7K3)\
**Post date:** [February 9, 2005, 12:54pm UTC](https://forum.kirupa.com/t/fwrite-problem/136915/1 "2005-02-09T12:54:43Z")

</div>

Hey guys,  
Ok so I have this swf and it exports an array to a php script… and then the php script does some manipulation of the scrip, followed up by writing it to a text file. Now here is where the confusion begins. When I am testing the swf like with the ctrl+enter in mx 2004, I export it like that, and test it. It works perfectly I can submit and refresh as much as I want and the code executes perfectly…  
However, when I put the swf on the webserver it no longer works right… Now it works once and then won’t work again for another 2-3min. then works once more and then is off for another 2-3min. I don’t understand… I have had the php script return the string that it is getting… and it does. It returns just right, exactly how I would like it to. But the stuff doesn’t get written to the file. Here is my php code…

```php
<?php
	if(!isset($user)){
		echo "report=You need to login before submitting anything... Thank You!";
	} else {
		$pointsArrayTrueArray = explode(",", $pointsArray);
		$counter = 0;
		$pointsContent = "pointsString=";
		while($counter < count($pointsArrayTrueArray)){
			$pointsContent .= $pointsArrayTrueArray[$counter];
			if(($counter+1) % 3 == 0 && $counter != 0){
				$pointsContent .="||";
			} else {
				$pointsContent .="~~";
			}
			$counter++;
		}
		if(is_writable("$user.txt")){
			if(!$fileID = fopen("$user.txt", "w")){
				echo "report=error opening file";
				exit;
			}
			 if (fwrite($fileID, $pointsContent) === FALSE) {
				 echo "report=error writing to file";
				 exit;
			  }
			fclose($fileID);
			echo "report=success";	
			
		} else {
			echo "report=not writeable";
		}
	}
?>

```

when this runs, and I send it the correct values, it returns success in the report variable, however it doesn’t work. Does anyone see where I am going wrong? Please help. Also here is the AS code which calls the php script…

```auto
on (release) {
	var submitPoints = new LoadVars();
	submitPoints.user = "Aaron";
	submitPoints.pointsArray = _parent.pointsArray;
	submitPoints.sendAndLoad("http://testing.tldstudio.com/misctests/whiteBoarding/submit.php", submitPoints);
	submitPoints.onLoad = function(success) {
		_parent.version_txt.text = this.report;
	};
}

```

Thanks for any help…
