notes postgres backend

This commit is contained in:
bogale 2026-09-29 17:49:35 +09:00
commit 6519fa6827
9 changed files with 82 additions and 55 deletions

View file

@ -1,15 +1,18 @@
<?php
$_shared = $_SERVER["DOCUMENT_ROOT"] . "/templates";
$_title = "Notes";
$root = $_SERVER["DOCUMENT_ROOT"];
require "$root/templates/header.php";
require "$_shared/header.php";
?>
<a href="write.php">Write a note</a><br>
<h4>Notes</h4>
<?php
foreach (scandir("notesDir") as $note) {
if ($note === '.' || $note === '..')
continue;
echo "<a href='write.php?title=$note'>$note</a><br>\n";
require_once "$_shared/lib.php";
$pdo = pdo_init();
$entries = $pdo->query("select * from notes.entries order by date desc");
foreach ($entries as $entry) {
$id = $entry["id"];
$text = $entry["title"];
echo "<a href='write.php?id=$id'>$text</a><br>\n";
}
require "$root/templates/footer.php";
require "$_shared/footer.php";
?>