From d1a804db47fe0437278c1a55e395971026b8c7f9 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Wed, 23 Apr 2025 01:19:10 +0500 Subject: feat: report system --- public/report/send.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 public/report/send.php (limited to 'public/report/send.php') diff --git a/public/report/send.php b/public/report/send.php new file mode 100644 index 0000000..0b7abaf --- /dev/null +++ b/public/report/send.php @@ -0,0 +1,35 @@ +prepare("INSERT INTO reports(sender_id, contents) VALUES (?, ?)"); +$stmt->execute([$_SESSION["user_id"], str_safe($_POST["contents"], 200)]); + +$report_id = $db->lastInsertId(); + +$stmt = $db->prepare("SELECT * FROM reports WHERE id = ?"); +$stmt->execute([$report_id]); + +if (CLIENT_REQUIRES_JSON) { + json_response([ + "status_code" => 201, + "message" => null, + "data" => $stmt->fetch(PDO::FETCH_ASSOC) + ], 201); + exit; +} + +generate_alert("/report?id=$report_id", "Thank you for your vigilance! MODS will take action as soon as possible.", 200); -- cgit v1.2.3