47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
||
|
||
include 'config.php';
|
||
|
||
$id = (int)$_GET["id"];
|
||
|
||
if ($id === null) {
|
||
exit();
|
||
}
|
||
|
||
$query = "
|
||
SELECT * FROM data
|
||
WHERE id = {$id};
|
||
";
|
||
|
||
$qresp = pg_query($db, $query);
|
||
$arr = pg_fetch_array($qresp);
|
||
|
||
$properTitle = $pageTitle . " – question #" . $id;
|
||
include 'boilerplate/pageStart.php';
|
||
|
||
echo("<link rel=\"stylesheet\" href=\"css/indiv.css\">");
|
||
|
||
if (pg_num_rows($qresp) === 0 || $arr["ispublic"] === "f" || $arr["isrespondedto"] === "f") {
|
||
echo("<h2 class=\"title\">{$pageTitle} – no such question exists</h2>");
|
||
echo("<a class=\"goback\" href=\"index.php\">(go back?)</a>");
|
||
http_response_code(404);
|
||
} else {
|
||
echo("<h2 class=\"title\">{$pageTitle} – question number " . $arr["id"] . "</h2>");
|
||
|
||
echo("<a class=\"goback\" href=\"index.php\">(go back?)</a>");
|
||
echo("<div class=\"question\">");
|
||
if ($arr["iscwed"] === "t") {
|
||
echo("<details><summary>cw: " . htmlspecialchars($arr["cw"]) . "</summary><span class=\"cwfiller\"></span>");
|
||
}
|
||
echo(htmlspecialchars($arr["text"]));
|
||
echo("<div class=\"time\">" . $arr["time"] . "</div>");
|
||
echo("<div class=\"response\">" . $arr["responsetext"] . "");
|
||
echo("<div class=\"time\">" . $arr["responsetime"] . "</div></div>");
|
||
if ($arr["iscwed"] === "t") {
|
||
echo("</details></div>");
|
||
} else {
|
||
echo("</div>");
|
||
}
|
||
}
|
||
|
||
?>
|