system
20
<?php
//return var 'news'
$filename = 'news.txt';
$somecontent = stripslashes($_POST['news']);
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'w')) {
print "news=Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (!fwrite($handle, $tag)) {
print "news=Cannot write to file ($filename)";
exit;
}
// print "news=$tag";
fclose($handle);
if (!$handle = fopen($filename, 'a')) {
print "news=Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (!fwrite($handle, $somecontent)) {
print "Cannot write to file ($filename)";
exit;
print "news=$somecontent";
fclose($handle);
}
print "news=$somecontent";
} else {
print "news=The file $filename is not writable";
}
?>