<?php
$fname = $_GET['f'];
if ($fname != '' && is_file("data/" . $fname) && file_exists("data/" . $fname)) {
$file_content = file_get_contents("data/" . $fname);
}
$new_title = $_POST['title'];
$new_content = $_POST['content'];
if (isset($_POST['edit'])) {
echo $new_title;
echo "<br>";
echo $new_content;
file_put_contents("data/" . $new_title, $new_content);
echo "<hr>";
echo file_get_contents("data/" . $new_title);
if ($new_title != $fname) {
rename("data/" . $fname, "data/" . $new_title);
}
}
if (isset($_POST['delete'])) {
$fname = $_GET['f'];
unlink("data/" . $tst);
}
?>