diff --git a/index.php b/index.php
index 215f332..c1a95e7 100644
--- a/index.php
+++ b/index.php
@@ -46,23 +46,30 @@
echo '
';
- if (isset($_POST['savebutton']))
+ $action = '';
+ if (isset($_POST['action'])) $action = $_POST['action'];
+ else if (isset($_GET['action'])) $action = $_GET['action'];
+
+ $param = '';
+ if (isset($_GET['param'])) $param = $_GET['param'];
+
+ if ($action == 'save')
{
$title = $_POST['title'];
$content = $_POST['content'];
file_put_contents($dir . '/' . $title, $content);
- $_GET['openaction'] = true;
- $_GET['userdata'] = $title;
+ $action = 'open';
+ $param = $title;
}
- else if (isset($_POST['deletebutton']))
+ else if ($action == 'delete')
{
$title = $_POST['title'];
rename($dir . '/' . $title, $dir . '/' . $title . '.del');
}
- if (isset($_GET['openaction']))
+ if ($action == 'open')
{
- $title = $_GET['userdata'];
+ $title = $param;
$content = '';
if (!file_exists($dir . '/' . $title))
@@ -78,8 +85,11 @@
echo '';
echo '
';
@@ -113,17 +126,17 @@
{
$name = basename($path);
if (!str_ends_with($name, '.del')
- && (!isset($_GET['filteraction']) || str_contains($name, $_GET['userdata'])))
+ && ($action != 'filter' || str_contains($name, $param)))
{
- if (isset($_GET['searchaction']))
+ if ($action == 'search')
{
$content = file_get_contents($path);
- if (!str_contains($content, $_GET['userdata']))
+ if (!str_contains($content, $param))
{
continue;
}
}
- echo '';
+ echo '';
}
}
echo '
';