diff --git a/index.php b/index.php index e1e1397..af4d5bc 100644 --- a/index.php +++ b/index.php @@ -34,18 +34,18 @@
- View list New note Access denied.'; exit; } + echo 'List New'; + if (isset($_POST['savebutton'])) { $title = $_POST['title']; @@ -58,17 +58,20 @@ $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); + + $content = ''; + if (!file_exists($dir . '/' . $title)) + { + file_put_contents($dir . '/' . $title, $content); + } + else + { + $content = file_get_contents($dir . '/' . $title); + } echo '