From c18744c45fe8dc2e3189139112dcff90bed149f5 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Tue, 20 Feb 2024 16:23:37 +0100 Subject: [PATCH] change: save before returning home --- index.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/index.php b/index.php index 3fd3378..9769aa2 100644 --- a/index.php +++ b/index.php @@ -27,9 +27,6 @@ exit; } - require 'libs/Parsedown.php'; - $homelink = 'home '; - $action = ''; if (isset($_POST['action'])) $action = $_POST['action']; else if (isset($_GET['action'])) $action = $_GET['action']; @@ -37,6 +34,11 @@ $param = ''; if (isset($_GET['param'])) $param = $_GET['param']; + if (isset($_POST['home'])) + { + $action = 'save'; + } + $content = ''; if ($action == 'save') { @@ -52,6 +54,11 @@ $action = 'open'; $param = $title; + + if (isset($_POST['home'])) + { + header('Location: index.php'); + } } else if ($action == 'delete') { @@ -61,6 +68,7 @@ if ($action == 'preview') { + require 'libs/Parsedown.php'; $title = $_POST['title']; $content = $_POST['content']; $Parsedown = new Parsedown(); @@ -91,8 +99,9 @@ $length = strlen($content); echo '
-
' . $homelink . - ' + + echo ' +