diff --git a/docs/comment.php b/docs/comment.php new file mode 100644 index 0000000..418aa96 --- /dev/null +++ b/docs/comment.php @@ -0,0 +1,11 @@ + diff --git a/docs/index.php b/docs/index.php index 713987a..5df21fc 100755 --- a/docs/index.php +++ b/docs/index.php @@ -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(); } diff --git a/libs/comment.php b/libs/comment.php index 9ba3140..2d5a70e 100644 --- a/libs/comment.php +++ b/libs/comment.php @@ -37,6 +37,12 @@ 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) { ?>