Access denied.';
exit;
}
if (isset($_POST['savebutton']))
{
$title = $_POST['title'];
$content = $_POST['content'];
file_put_contents($dir . '/' . $title, $content);
$_GET['open'] = $title;
}
else if (isset($_POST['deletebutton']))
{
$title = $_POST['title'];
rename($dir . '/' . $title, $dir . '/' . $title . '.del');
}
else if (isset($_GET['create']))
{
$title = time() . '.md';
file_put_contents($dir . '/' . $title, '');
$_GET['open'] = $title;
}
if (isset($_GET['open']))
{
$title = $_GET['open'];
$content = file_get_contents($dir . '/' . $title);
echo '';
}
else
{
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (str_ends_with($file, '.md'))
{
$mod = date("F d Y H:i:s", filemtime($dir . '/' . $file));
echo '';
}
}
closedir($dh);
}
}
?>