Access denied.';
exit;
}
echo '
';
if (isset($_POST['savebutton']))
{
$title = $_POST['title'];
$content = $_POST['content'];
file_put_contents($dir . '/' . $title, $content);
$_GET['openaction'] = true;
$_GET['userdata'] = $title;
}
else if (isset($_POST['deletebutton']))
{
$title = $_POST['title'];
rename($dir . '/' . $title, $dir . '/' . $title . '.del');
}
if (isset($_GET['openaction']))
{
$title = $_GET['userdata'];
$content = '';
if (!file_exists($dir . '/' . $title))
{
file_put_contents($dir . '/' . $title, $content);
}
else
{
$content = file_get_contents($dir . '/' . $title);
}
$nblines = max(20, substr_count($content, "\r\n") + 1) * 2;
echo '';
}
else
{
$defaulttitle = date("Y-m-d H.i.s", time());
if (isset($_GET['userdata']))
{
$defaulttitle = $_GET['userdata'];
}
echo '';
echo '
';
$files = glob($dir . '/*');
usort($files, function($a, $b)
{
return filemtime($b) - filemtime($a);
});
foreach($files as $path)
{
$name = basename($path);
if (!str_ends_with($name, '.del')
&& (!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 '';
}
}
echo '
';
}
?>