diff options
| author | ilotterytea <iltsu@alright.party> | 2025-12-08 21:53:36 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-12-08 21:53:36 +0500 |
| commit | 57472eab3c7b035392c6a5aa240593ecaa7d1ccf (patch) | |
| tree | 9da30829290f225be2dab3d383549cbfda82ed19 /public/report/send.php | |
| parent | 6541d0f3888862ab049055fd418b700f73eed367 (diff) | |
upd: moved all /public/ files to the root folder
Diffstat (limited to 'public/report/send.php')
| -rw-r--r-- | public/report/send.php | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/public/report/send.php b/public/report/send.php deleted file mode 100644 index ab136e1..0000000 --- a/public/report/send.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php -include_once "../../src/accounts.php"; -include_once "../../src/config.php"; -include_once "../../src/utils.php"; -include_once "../../src/alert.php"; - -if (!REPORTS_ENABLE) { - generate_alert("/404.php", "Reports are disabled", 403); - exit; -} - -if (!authorize_user(true)) { - exit; -} - -if (isset($_SESSION["user_role"]) && !$_SESSION["user_role"]["permission_report"]) { - generate_alert("/404.php", "Not enough permissions", 403); - exit; -} - -$db = new PDO(DB_URL, DB_USER, DB_PASS); - -if (!isset($_POST["contents"])) { - generate_alert("/report", "Not enough POST fields"); - exit; -} - -$stmt = $db->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); |
