isStaff()) { redirect("/"); } $xml = file_get_contents('compress.zlib://PlayerReport.txt'); $validXML = true; try { $ParsedXML = new SimpleXMLElement($xml); } catch (Exception $e) { $validXML = false; } if ($validXML) { $reporteruserid = (int)$ParsedXML->attributes()->userID; $placeid = (int)$ParsedXML->attributes()->placeID; $jobid = (string)$ParsedXML->attributes()->gameJobID; $commentdata = explode(";", $ParsedXML->comment); $abuserid = (int)filter_var($commentdata[0], FILTER_SANITIZE_NUMBER_INT); $reportreason = (string)trim($commentdata[1]); $reportdescription = (string)trim($commentdata[2]); $chats = $ParsedXML->xpath('//message'); $jsonData = array( "ReporterUid" => $reporteruserid, "PlaceId" => $placeid, "JobId" => $jobid, "AbuserId" => $abuserid, "Reason" => $reportreason, "Description" => $reportdescription ); foreach($chats as $chat) { $userid = (int)$chat['userID']; $username = (string)getUsername($userid); $userchat = (string)$chat; $chatData = array( "username" => $username, "userid" => $userid, "chat" => $userchat ); array_push($jsonData, $chatData); } die(json_encode($jsonData)); }