<html><body>
<?php

// Writing to files with r+ mode
/* Note the directory to write to must have public writing permissions */
/* Don't have public directories/files with public writing permissions */

$t1 = "X X1,10,11";
$t2 = "Z Z1,20,21";

// Try to open the file
@ $f = fopen('/home/abu-jeib/temp/a.txt','r+');

// If not opened successfully
if (!$f)
{
	echo "ERROR: file can't be opened.<P>\n";
	exit;
}
else // If succeeds
{
	// Read two lines from the file
	$s = fgets($f);
	$s = fgets($f);

	// Write two lines to the file
	fwrite($f,$t1."\n");
	fwrite($f,$t2."\n");

	// Close the file
	fclose($f);
}

?>
</body></html>
