Any idea why this PHP fails to write a file?

Miscellaneous Forums/General Discussion/Any idea why this PHP fails to write a file?

Can't find anything in my websites cpanel :-(

I have written this test code:

<?php

// list of product buy pages
$files		= array("test1, "test2");
$lognames	= array("test1", "test2");










// all the boring processing stuff below...
$id = $_GET['id'];
if ($id >= 0 && $id < sizeof($files) && is_numeric($id)) {
	$log_filename = $lognames[$id] . ".log.txt";
	$redirect_url = $files[$id];
	$handle = @fopen($log_filename, "r");
	echo '<html><body>Got handle<br></body></html>';
	if ($handle) {
		echo '<html><body>Read File<br></body></html>';
		$curr_count = fgets($handle);
		fclose($handle);
	}
	else
		echo '<html><body>No file to read<br></body></html>';
	if (!is_numeric($curr_count))
		$curr_count = 1;
	else
		$curr_count++;
	$handle = @fopen($log_filename, "w");
	if ($handle) {
		echo '<html><body>wrote file<br></body></html>';
		fwrite($handle, $curr_count);
		fclose($handle);
	}
	else
		echo '<html><body>did not writefile<br></body></html>';

} else {
	echo '<html><body>Error: Invalid file specified</body></html>';
	exit();
}

?>


And I get this output:

Got handle
No file to read
did not writefile

So it is not writing it, sob. Why not, gah!