} else { exit(json_encode(array('error' => 1, 'msg' => 'No log file found.'))); } // Get requested byte range $start = isset($_REQUEST['start']) ? intval($_REQUEST['start']) : 0; $end = isset($_REQUEST['end']) ? intval($_REQUEST['end']) : null; $data = @file_get_contents($file, false, null, $start, $end); $return = array('start' => $start, 'end' => $start + strlen($data), 'data' => $data); if ($data === false) { $data = file_get_contents($file, false, null, 0, 30 * 1024); $return = array('error' => 2, 'msg' => 'Failed to requested bytes from the log file. Returned first 30 KB.', 'start' => 0, 'end' => strlen($data), 'data' => $data); } echo json_encode($return); case 'players': require_once 'inc/MinecraftQuery.class.php'; $mq = new MinecraftQuery(); try { $mq->Connect(KT_LOCAL_IP, $user['port'], 2); // 2 second timeout } catch (MinecraftQueryException $ex) { echo json_encode(array('error' => 1, 'msg' => $ex->getMessage())); die; } $data = array('info' => $mq->GetInfo(), 'players' => $mq->GetPlayers()); echo json_encode($data); break; case 'set_jar': $result = user_modify($user['user'], $user['pass'], $user['role'], $user['home'], $user['ram'], $user['port'], $_POST['jar']); echo json_encode($result); break; }
<?php require_once 'inc/lib.php'; if ($_POST['action'] == 'user-update') { user_modify($_POST['user'], $_POST['pass'], $_POST['role'], $_POST['dir'], $_POST['ram'], $_POST['port']); } ?> <!doctype html> <html> <head> <title>User Profile | MCHostPanel</title> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/bootstrap-responsive.min.css"> <link rel="stylesheet" href="css/smooth.css" id="smooth-css"> <link rel="stylesheet" href="css/style.css"> <meta name="author" content="James Pollock [jamesplanet.net]"> <script src="js/jquery-1.7.2.min.js"></script> <script src="js/bootstrap.min.js"></script> </head> <body> <?php require 'inc/top.php'; ?> <div class="tab-content"> <div class="tab-pane active"> <div class="container-fluid"> <div class="row-fluid"> <legend>User Profile</legend> <div id="profileArea"> <form action="userProfile.php" method="post"> <input type="hidden" name="action" value="user-update">