i uploaded a text file called 'logs.txt' and write.php to a www folder on a server (i got a subdomain)
so the links to these are like, E.G:.
www.site-here.com/logs.txt
www.site-here.com/write.php
then why doesnt something like this work:
www.site-here.com/write.php?txt=Hello
and it should write the word 'Hello' to logs.txt
Heres write.php..
any help guys?PHP Code:<?php
$filename = 'logs.txt';
$somecontent = $_GET['txt'] . "\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";
}
?>
i just keep getting: Cannot write to file logs.txt




Reply With Quote