parent
a1202902be
commit
54583b1d88
24
index.php
24
index.php
|
@ -3,9 +3,9 @@
|
|||
<head>
|
||||
<title>
|
||||
<?php
|
||||
if (isset($_GET['open']))
|
||||
if (isset($_GET['openaction']))
|
||||
{
|
||||
echo $_GET['open'];
|
||||
echo $_GET['userdata'];
|
||||
}
|
||||
?>
|
||||
</title>
|
||||
|
@ -44,12 +44,15 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
echo '<div><a accesskey="h" href="/">home</a></div><br>';
|
||||
|
||||
if (isset($_POST['savebutton']))
|
||||
{
|
||||
$title = $_POST['title'];
|
||||
$content = $_POST['content'];
|
||||
file_put_contents($dir . '/' . $title, $content);
|
||||
$_GET['open'] = $title;
|
||||
$_GET['openaction'] = true;
|
||||
$_GET['userdata'] = $title;
|
||||
}
|
||||
else if (isset($_POST['deletebutton']))
|
||||
{
|
||||
|
@ -57,9 +60,9 @@
|
|||
rename($dir . '/' . $title, $dir . '/' . $title . '.del');
|
||||
}
|
||||
|
||||
if (isset($_GET['open']))
|
||||
if (isset($_GET['openaction']))
|
||||
{
|
||||
$title = $_GET['open'];
|
||||
$title = $_GET['userdata'];
|
||||
|
||||
$content = '';
|
||||
if (!file_exists($dir . '/' . $title))
|
||||
|
@ -75,7 +78,6 @@
|
|||
|
||||
echo '<form action="index.php" method="POST">
|
||||
<div>
|
||||
<input accesskey="h" type="submit" name="homebutton" value="home">
|
||||
<input type="submit" name="savebutton" value="save" accesskey="s">
|
||||
<input accesskey="d" type="submit" name="deletebutton" value="delete">
|
||||
</div>
|
||||
|
@ -89,8 +91,9 @@
|
|||
else
|
||||
{
|
||||
echo '<form action="index.php" method="GET">
|
||||
<input list="notes" name="open" value="' . date("Y-m-d H.i.s", time()) . '">
|
||||
<input accesskey="n" type="submit" value="open">
|
||||
<input list="notes" name="userdata" value="' . date("Y-m-d H.i.s", time()) . '">
|
||||
<input accesskey="n" type="submit" name="openaction" value="open">
|
||||
<input accesskey="f" type="submit" name="filteraction" value="filter">
|
||||
</form>';
|
||||
echo '<br>';
|
||||
|
||||
|
@ -103,9 +106,10 @@
|
|||
foreach($files as $path)
|
||||
{
|
||||
$name = basename($path);
|
||||
if (!str_ends_with($name, '.del'))
|
||||
if (!str_ends_with($name, '.del')
|
||||
&& (!isset($_GET['filteraction']) || str_contains($name, $_GET['userdata'])))
|
||||
{
|
||||
echo '<div><a href=index.php?open=' . urlencode($name) . '>' . $name .'</a></div>';
|
||||
echo '<div><a href=index.php?openaction&userdata=' . urlencode($name) . '>' . $name .'</a></div>';
|
||||
}
|
||||
}
|
||||
echo '<br>';
|
||||
|
|
Loading…
Reference in New Issue