crappy ui for threads

This commit is contained in:
biglyderv 2024-12-11 23:51:42 -05:00
parent 1f56e6df3c
commit 22756c834e
3 changed files with 25 additions and 4 deletions

11
docs/comment.php Normal file
View file

@ -0,0 +1,11 @@
<?php
require("../libs/page.php");
require("../libs/form.php");
require("../libs/comment.php");
$ref = 1732684297;
page_header();
comments("comment",$_GET['id']);
page_footer();
?>

View file

@ -6,8 +6,8 @@
$ref = 1732684297;
function getOut($typer, $idr) {
if ($typer == 'user') {
header("Location: " . '/user.php?id=' . htmlspecialchars($idr));
if ($typer == 'user' || $typer == 'comment') {
header("Location: " . '/' . $typer . '.php?id=' . htmlspecialchars($idr));
die();
}

View file

@ -37,6 +37,12 @@
</div>
<?php
$stmt = $db->prepare("SELECT * FROM comment WHERE id = ? ORDER BY date DESC");
$stmt->execute([
$idr
]);
$posts1 = $stmt->fetchAll(PDO::FETCH_DEFAULT);
$stmt = $db->prepare("SELECT * FROM comment WHERE targetType = ? AND targetId = ? ORDER BY date DESC LIMIT ? OFFSET ?");
$stmt->execute([
$typer,
@ -45,7 +51,9 @@
$page * 10
]);
$posts = $stmt->fetchAll(PDO::FETCH_DEFAULT);
$posts2 = $stmt->fetchAll(PDO::FETCH_DEFAULT);
$posts = array_merge($posts1,$posts2);
foreach ($posts as $post) { ?>
<div class='comment'>
@ -58,7 +66,9 @@
</a>
</b></div>
<div><b>
<?php echo date(DATE_RFC2822,$post['date'] + $ref) ?>
<a class='link' href='/comment.php?id=<?php echo $post['id'] ?>'>
<?php echo date(DATE_RFC2822,$post['date'] + $ref) ?>
</a>
</b></div>
</div>
</div>