diff --git a/admin/all.php b/admin/all.php index d002a9e..f9896ee 100644 --- a/admin/all.php +++ b/admin/all.php @@ -28,6 +28,10 @@ foreach (array_reverse($rows) as $i) { echo("

" . $pageTitle . " – admin

"); +$properTitle = $pageTitle . " – admin"; + +include '../boilerplate/pageStart.php'; + if ($_GET["deleted"] == 1) { echo("deleted!"); } @@ -55,7 +59,7 @@ foreach (array_reverse($rows) as $i){ if ($i["isrespondedto"] === "f" && $i["ispublic"] == "t") { echo("
"); if ($i["iscwed"] === "t") { - echo("
cw: " . htmlspecialchars($i["cw"]) . ""); + echo("
cw: " . htmlspecialchars($i["cw"]) . "
"); } echo(htmlspecialchars($i["text"])); echo("
" . $i["time"] . "
"); @@ -68,7 +72,7 @@ foreach (array_reverse($rows) as $i){ if ($i["ispublic"] === "f" && $i["isprivread"] === "f") { echo("
"); if ($i["iscwed"] === "t") { - echo("
cw: " . htmlspecialchars($i["cw"]) . ""); + echo("
cw: " . htmlspecialchars($i["cw"]) . "
"); } echo(htmlspecialchars($i["text"])); echo("
" . $i["time"] . "
"); @@ -81,7 +85,7 @@ foreach (array_reverse($rows) as $i){ if ($i["ispublic"] === "t" && $i["isrespondedto"] === "t") { echo("
"); if ($i["iscwed"] === "t") { - echo("
cw: " . htmlspecialchars($i["cw"]) . ""); + echo("
cw: " . htmlspecialchars($i["cw"]) . "
"); } echo(htmlspecialchars($i["text"])); echo("
" . $i["time"] . "
"); @@ -96,7 +100,7 @@ foreach (array_reverse($rows) as $i){ if ($i["ispublic"] === "f" && $i["isprivread"] === "t") { echo("
"); if ($i["iscwed"] === "t") { - echo("
cw: " . htmlspecialchars($i["cw"]) . ""); + echo("
cw: " . htmlspecialchars($i["cw"]) . "
"); } echo(htmlspecialchars($i["text"])); echo("
" . $i["time"] . "
"); @@ -104,4 +108,6 @@ foreach (array_reverse($rows) as $i){ } } +include '../boilerplate/pageEnd.php'; + ?> diff --git a/admin/index.php b/admin/index.php index 2dfb424..6f6dcdc 100644 --- a/admin/index.php +++ b/admin/index.php @@ -17,6 +17,9 @@ if ($_GET["pw"] === $adminPassword) { include 'all.php'; } } else { + $properTitle = $pageTitle . " – sign in"; + include 'boilerplate/pageStart.php'; + echo("

enter password

"); echo("

"); } diff --git a/admin/respond.php b/admin/respond.php index 1c2a7e0..6b40332 100644 --- a/admin/respond.php +++ b/admin/respond.php @@ -34,6 +34,10 @@ WHERE id = {$id}; $qresp = pg_query($db, $query); $arr = pg_fetch_array($qresp); +$runOnLoad = "document.getElementById(\"passinput\").value = " . htmlspecialchars($arr["responsetext"]); +$properTitle = $pageTitle . " – respond to question #" . $id; +include 'boilerplate/pageStart.php'; + echo(""); if ($arr["ispublic"] === "f") { @@ -57,7 +61,7 @@ if ($arr["ispublic"] === "f") { } else { echo("

enter a response

"); } - echo("

"); + echo("

"); } ?> diff --git a/boilerplate/pageEnd.php b/boilerplate/pageEnd.php new file mode 100644 index 0000000..087b532 --- /dev/null +++ b/boilerplate/pageEnd.php @@ -0,0 +1,5 @@ + +echo("") + +?> \ No newline at end of file diff --git a/boilerplate/pageStart.php b/boilerplate/pageStart.php new file mode 100644 index 0000000..8bf6eb4 --- /dev/null +++ b/boilerplate/pageStart.php @@ -0,0 +1,5 @@ + +echo("" . $properTitle . "") + +?> \ No newline at end of file diff --git a/fetch.php b/fetch.php index 505d24e..f294af8 100644 --- a/fetch.php +++ b/fetch.php @@ -16,6 +16,9 @@ WHERE id = {$id}; $qresp = pg_query($db, $query); $arr = pg_fetch_array($qresp); +$properTitle = $pageTitle . " – question #" . $id; +include 'boilerplate/pageStart.php'; + echo(""); if (pg_num_rows($qresp) === 0 || $arr["ispublic"] === "f" || $arr["isrespondedto"] === "f") { @@ -28,7 +31,7 @@ if (pg_num_rows($qresp) === 0 || $arr["ispublic"] === "f" || $arr["isrespondedto echo("(go back?)"); echo("
"); if ($arr["iscwed"] === "t") { - echo("
cw: " . htmlspecialchars($arr["cw"]) . ""); + echo("
cw: " . htmlspecialchars($arr["cw"]) . "
"); } echo(htmlspecialchars($arr["text"])); echo("
" . $arr["time"] . "
"); diff --git a/index.php b/index.php index 999474d..83f962b 100644 --- a/index.php +++ b/index.php @@ -10,6 +10,10 @@ $qresp = pg_query($db, $query); $rows = pg_fetch_all($qresp); +$properTitle = $pageTitle . " – all questions"; + +include 'boilerplate/pageStart.php'; + echo(""); echo("

" . $pageTitle . "

"); @@ -36,7 +40,7 @@ foreach (array_reverse($rows) as $i){ if ($i["ispublic"] === "t" && $i["isrespondedto"] === "t") { echo("
"); if ($i["iscwed"] === "t") { - echo("
cw: " . htmlspecialchars($i["cw"]) . ""); + echo("
cw: " . htmlspecialchars($i["cw"]) . "
"); } echo(htmlspecialchars($i["text"])); echo("
" . $i["time"] . "
");