add root param

add search action
This commit is contained in:
quenousimporte 2024-02-16 16:58:06 +01:00
parent 54583b1d88
commit ccd63ea392
2 changed files with 17 additions and 2 deletions

View File

@ -44,7 +44,7 @@
exit; exit;
} }
echo '<div><a accesskey="h" href="/">home</a></div><br>'; echo '<div><a accesskey="h" href="' . $root . '">home</a></div><br>';
if (isset($_POST['savebutton'])) if (isset($_POST['savebutton']))
{ {
@ -90,10 +90,16 @@
} }
else else
{ {
$defaulttitle = date("Y-m-d H.i.s", time());
if (isset($_GET['userdata']))
{
$defaulttitle = $_GET['userdata'];
}
echo '<form action="index.php" method="GET"> echo '<form action="index.php" method="GET">
<input list="notes" name="userdata" value="' . date("Y-m-d H.i.s", time()) . '"> <input list="notes" name="userdata" value="' . $defaulttitle . '">
<input accesskey="n" type="submit" name="openaction" value="open"> <input accesskey="n" type="submit" name="openaction" value="open">
<input accesskey="f" type="submit" name="filteraction" value="filter"> <input accesskey="f" type="submit" name="filteraction" value="filter">
<input accesskey="g" type="submit" name="searchaction" value="search">
</form>'; </form>';
echo '<br>'; echo '<br>';
@ -109,6 +115,14 @@
if (!str_ends_with($name, '.del') if (!str_ends_with($name, '.del')
&& (!isset($_GET['filteraction']) || str_contains($name, $_GET['userdata']))) && (!isset($_GET['filteraction']) || str_contains($name, $_GET['userdata'])))
{ {
if (isset($_GET['searchaction']))
{
$content = file_get_contents($path);
if (!str_contains($content, $_GET['userdata']))
{
continue;
}
}
echo '<div><a href=index.php?openaction&userdata=' . urlencode($name) . '>' . $name .'</a></div>'; echo '<div><a href=index.php?openaction&userdata=' . urlencode($name) . '>' . $name .'</a></div>';
} }
} }

View File

@ -1,4 +1,5 @@
<?php <?php
$password = ''; $password = '';
$dir = ''; $dir = '';
$root = '/';
?> ?>