The code below adds text to the file in the format of:
www.my-site.com/filename.php?data=hello
but then how can i make a php file which will allow me to remove the word 'hello' from test.txtPHP Code:<?php
$filename = 'test.txt';
$somecontent = $_GET['data'] . "\n";
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
?>
www.my-site.com/remove.php?data=hello
any help on this please?




Reply With Quote