'Reported', 1 => 'To-Do List', 2 => 'Confirmed bug', 3 => 'Invalid', 4 => 'Rejected', 5 => 'Fixed' ); // Fetch data from SQL $reportsData = mysql_select_multi("SELECT id, name, posx, posy, posz, report_description, date, status FROM znote_player_reports ORDER BY id DESC;"); // If sql data is not empty if ($reportsData !== false) { // Order reports array by ID for easy reference later on. $reports = array(); for ($i = 0; $i < count($reportsData); $i++) $reports[$reportsData[$i]['id']] = $reportsData[$i]; } // POST logic (Update report and give player points) if (!empty($_POST)) { // Fetch POST data $playerName = getValue($_POST['playerName']); $status = getValue($_POST['status']); $price = getValue($_POST['price']); $customPoints = getValue($_POST['customPoints']); $reportId = getValue($_POST['id']); if ($customPoints !== false) $price = (int)($price + $customPoints); // Update SQL mysql_update("UPDATE `znote_player_reports` SET `status`='$status' WHERE `id`='$reportId' LIMIT 1;"); // Update local array representation $reports[$reportId]['status'] = $status; // If we should give user price if ($price > 0) { $account = mysql_select_single("SELECT `a`.`id`, `a`.`email` FROM `accounts` AS `a` INNER JOIN `players` AS `p` ON `p`.`account_id` = `a`.`id` WHERE `p`.`name` = '$playerName' LIMIT 1;"); if ($account !== false) { // transaction log mysql_insert("INSERT INTO `znote_paypal` VALUES ('', '$reportId', 'report@admin.".$user_data['name']." to ".$account['email']."', '".$account['id']."', '0', '".$price."')"); // Process payment $data = mysql_select_single("SELECT `points` AS `old_points` FROM `znote_accounts` WHERE `account_id`='".$account['id']."';"); // Give points to user $new_points = $data['old_points'] + $price; mysql_update("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='".$account['id']."'"); // Remind GM that he sent points to character echo "".$playerName." has been granted ".$price." points for his reports."; } } // GET logic (Edit report data and specify how many [if any] points to give to user) } elseif (!empty($_GET)) { // Fetch GET data $action = getValue($_GET['action']); $playerName = getValue($_GET['playerName']); $reportId = getValue($_GET['id']); // Fetch the report we intend to modify $report = $reports[$reportId]; // Create html form ?>
Report ID: #
Name: Position: Reported: Status: . Edit |
|