Add writable file/dir checking

This commit is contained in:
Hamid
2017-05-18 18:48:54 +04:30
parent 1e00c2f822
commit dd698470ff
+5 -3
View File
@@ -69,9 +69,11 @@ if (isset($_POST['action'])) {
break;
case 'save':
if (isset($_POST['file']) && isset($_POST['data'])) {
file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . $_POST['file'], $_POST['data']);
echo br2nl(highlight_string(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . $_POST['file']), true));
$file = __DIR__ . DIRECTORY_SEPARATOR . $_POST['file'];
if (isset($_POST['file']) && isset($_POST['data']) && is_writable($file)) {
file_put_contents($file, $_POST['data']);
echo br2nl(highlight_string(file_get_contents($file), true));
}
break;