diff --git a/html/MCP/reports/data/PlayerReport.txt b/html/MCP/reports/data/PlayerReport.txt deleted file mode 100644 index 28478e6..0000000 --- a/html/MCP/reports/data/PlayerReport.txt +++ /dev/null @@ -1,55 +0,0 @@ - - AbuserID:3;Cheating/Exploiting; Short Description (Optional) - - ass - nigger - ass - nigger - ass - ass - niggre - nigger - ass - a - a - a - a - a - a - a - chode - what - ass - ass - ass - nigger - assssss - ass - nigger - a - a - ass - ass - asss - ass - ass - ass - ass - nigger - ngg - ass - a - ass - ass - ass - ass - a - a - chode - what - a - a - ass - ass - - \ No newline at end of file diff --git a/html/MCP/reports/data/close.php b/html/MCP/reports/data/close.php new file mode 100644 index 0000000..cd85cfe --- /dev/null +++ b/html/MCP/reports/data/close.php @@ -0,0 +1,25 @@ +isStaff() || !$id) { + redirect("/MCP"); +} + +$report = $GLOBALS['pdo']->prepare("UPDATE user_reports SET `closed` = 1 WHERE `id` = :id AND `closed` = 0"); +$report->bindParam(":id", $id, PDO::PARAM_INT); +$report->execute(); +if ($report->rowCount() > 0) { + die(json_encode(["alert"=>"Closed Report"])); +} else { + die(json_encode(["alert"=>"Invalid Report"])); +} \ No newline at end of file diff --git a/html/MCP/reports/data/index.php b/html/MCP/reports/data/index.php index 5c1cc4b..daf3504 100644 --- a/html/MCP/reports/data/index.php +++ b/html/MCP/reports/data/index.php @@ -1,15 +1,30 @@ isStaff()) -{ - redirect("/"); +$id = (int)$_GET['id']; + +if(!$user->isStaff() || !$id) { + redirect("/MCP"); } -$xml = file_get_contents('compress.zlib://PlayerReport.txt'); +$xml = ""; + +$report = $GLOBALS['pdo']->prepare("SELECT * FROM user_reports WHERE id = :id"); +$report->bindParam(":id", $id, PDO::PARAM_INT); +$report->execute(); +if ($report->rowCount() > 0) { + $xml = $report->fetch(PDO::FETCH_OBJ)->report; +} else { + die(json_encode(["alert"=>"Report not found"])); +} $validXML = true; try { diff --git a/html/MCP/reports/index.php b/html/MCP/reports/index.php index 1b73e09..a3ef85a 100644 --- a/html/MCP/reports/index.php +++ b/html/MCP/reports/index.php @@ -1,4 +1,9 @@ isAdmin()) die(); \ No newline at end of file diff --git a/html/MCP/reports/view.php b/html/MCP/reports/view.php index d538f0f..f19f335 100644 --- a/html/MCP/reports/view.php +++ b/html/MCP/reports/view.php @@ -1,20 +1,28 @@ isStaff()) -{ +/* + Alphaland 2021 + Report viewer +*/ + +if(!$user->isStaff()) { redirect("/"); } -if (!$_GET['id']) -{ - redirect("/MCP/reports/"); +//chek +$report = $GLOBALS['pdo']->prepare("SELECT * FROM user_reports WHERE `id` = :id AND `closed` = 0"); +$report->bindParam(":id", $_GET['id'], PDO::PARAM_INT); +$report->execute(); +if ($report->rowCount() == 0) { + redirect("/MCP/reports/"); } $body = <<Report Data +
Report Information

+
@@ -41,8 +49,7 @@ $body = <<
`; - $("#message-container").html(parseHtml(html, 1000, jsonData, "No logged chats")); + $("#message-container").html(parseHtml(html, 1000, jsonData, "No logged chats")); }); } -function closeReport() -{ - alert("will close"); +function closeReport() { + getJSONCDS("https://www.alphaland.cc/MCP/reports/data/close?id="+getparam) + .done(function(jsonData) { + var alert = jsonData.alert; + if(jsonData.alert == "Closed Report") { + window.location.href = "/MCP/reports/"; + } else { + $("#error_alert").text(alert); + $("#error_alert").show(); + window.scrollTo({top: 0, behavior: "smooth"}); + setTimeout(function() { + $("#error_alert").hide(); + }, 2000); + } + }); } populateReport(); diff --git a/html_api/moderation/AbuseReport/InGameChatHandler.php b/html_api/moderation/AbuseReport/InGameChatHandler.php index c6e0f89..93b555f 100644 --- a/html_api/moderation/AbuseReport/InGameChatHandler.php +++ b/html_api/moderation/AbuseReport/InGameChatHandler.php @@ -1,3 +1,23 @@ prepare("INSERT INTO `user_reports`(`report`, `whenReported`) VALUES(:report, UNIX_TIMESTAMP())"); + $report->bindParam(":report", $xml, PDO::PARAM_STR); + $report->execute(); +} \ No newline at end of file