summaryrefslogtreecommitdiff
path: root/public/report/list.php
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-23 01:19:10 +0500
committerilotterytea <iltsu@alright.party>2025-04-23 01:19:10 +0500
commitd1a804db47fe0437278c1a55e395971026b8c7f9 (patch)
tree740de60383d7c16bbb9bd27dd7ce314fe6237b6e /public/report/list.php
parent999bfa6cad76900d4550e00e8e29f0252fb006b5 (diff)
feat: report system
Diffstat (limited to 'public/report/list.php')
-rw-r--r--public/report/list.php69
1 files changed, 69 insertions, 0 deletions
diff --git a/public/report/list.php b/public/report/list.php
new file mode 100644
index 0000000..128f994
--- /dev/null
+++ b/public/report/list.php
@@ -0,0 +1,69 @@
+<?php
+include_once "../../src/accounts.php";
+include_once "../../src/config.php";
+include_once "../../src/partials.php";
+include_once "../../src/utils.php";
+
+if (!authorize_user(true)) {
+ exit;
+}
+
+$db = new PDO(DB_URL, DB_USER, DB_PASS);
+
+$stmt = $db->prepare("SELECT * FROM reports WHERE sender_id = ? ORDER BY sent_at DESC");
+$stmt->execute([$_SESSION["user_id"]]);
+
+$reports = $stmt->fetchAll(PDO::FETCH_ASSOC);
+?>
+
+<html>
+
+<head>
+ <title>Report list - alright.party</title>
+ <link rel="stylesheet" href="/static/style.css">
+</head>
+
+<body>
+ <div class="container">
+ <div class="wrapper">
+ <?php html_navigation_bar() ?>
+ <section class="content">
+ <section class="box" style="width: 50%;">
+ <section class="box navtab">
+ Report list
+ </section>
+ <section class="box content">
+ <table>
+ <tr>
+ <th>Contents</th>
+ <th>Status</th>
+ <th style="min-width: 96px;"></th>
+ </tr>
+ <?php
+ foreach ($reports as $report) {
+ echo '<tr>';
+
+ echo '<td>' . substr($report["contents"], 0, 20) . "...";
+ echo ' <span style="font-size:12px; color: gray;">(' . format_timestamp(time() - strtotime($report["sent_at"])) . ' ago)</span>';
+ echo '</td>';
+
+ echo '<td>';
+ echo $report["resolved_by"] == null ? "<b style='color:red;'>Unresolved</b>" : "<b style='color:green;'>Resolved</b>";
+ echo '</td>';
+
+ echo '<td style="text-align:center;">';
+ echo '<a href="/report?id=' . $report["id"] . '">[ View ]</a>';
+ echo '</td>';
+
+ echo '</tr>';
+ }
+ ?>
+ </table>
+ </section>
+ </section>
+ </section>
+ </div>
+ </div>
+</body>
+
+</html> \ No newline at end of file