<html>
<head>
</head>
<body>
<?php
$filecontents;
$filename = "test.htm";
$fpbackup = fopen($filename, 'r+')) //r+ = read + write, start at beginning
if (!$fp = fopen($filename, 'r+')) //r+ = read + write, start at beginning
{ echo "Cannot open file";
exit;
}
if (is_writable($filename))
{
$filecontents = file_get_contents($filename);
fclose($fp);
}
else {
clearstatcache();
echo "Cannot write to ".$filename." - Check permissions.";
}
echo "<b>" . $filename . "</b>" . " last modified: " . date("dMy H:s T", filemtime($filename));
?>
<form name="TextForm" method="post" action="
<?php echo $_SERVER['php_SELF'];?> ">
<TEXTAREA name="txtcontents" ROWS="30" COLS="100" /><?php echo $filecontents ?></TEXTAREA>
<br>
<input type="submit" value="Submit" />
<input type="submit" value="Backup" />
</form>
</body>
</html>