} } loadFile(); displayContents(); psconsole.scrollTop(psconsole[0].scrollHeight - psconsole.height()); }, 20); </script> <textarea id='console' rows='13' cols='100' spellcheck="off"></textarea> <form action="" method="POST"> <input type="text" style="width: 740px;" autocomplete="off" autofocus class="consolecmd" id="consolecmd" name="consolecmd"></textarea> <input type="submit" id="submit" name="submit" value="Send"></input> </form action="" method="POST"> </body> </html> <?php if (isset($_POST['submit'])) { $command = $_POST['consolecmd']; require_once 'rcon.php'; $host = 'localhost'; $port = 25575; $password = '******'; $timeout = 3; $rcon = new Rcon($host, $port, $password, $timeout); if ($rcon->connect()) { $rcon->send_command($command); } }
//cookie* $host = "localhost"; // Server host name or IP //Encryption and Decryption should be used to protect COOKIES //cookie* $port = $_SESSION["portcon"]; // Port rcon is listening on //Encryption and Decryption should be used to protect COOKIES //cookie* $password = "******"; // rcon.password setting set in server.properties $timeout = 3; // How long to timeout. $rcon = new Rcon($host, $port, $password, $timeout); if ($rcon->connect()) { $rcon->send_command("cp give {$sender} {$amount} hi"); } $APPtotal = $_SESSION['subapp']; $UUser = $_COOKIE['UID']; //Update the APPPurse in DB $connn = mysqli_connect("localhost", "phpmate", "freeagent7", "_datatrap"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } else { mysqli_query($connn, "UPDATE members SET points='{$APPtotal}'\nWHERE uid='{$UUser}'"); echo "Connected"; } unset($_POST['sendto']); unset($_POST['cmddo']); mysqli_close($connn);
$monsternum = rand(0, 2); $result = "spawnnamedmob Test" . $i . " " . $monsters[$monsternum] . " " . $x . " " . $y . " " . $z; $rcon = new Rcon($host, $port, $password, $timeout); if ($rcon->connect()) { $rcon->send_command($result); } sleep(2); } // End for loop } else { // Ok we have a valid mob to spawn!! Let's DO this thing. // Setup the Minecraft command. $result = "spawnnamedmob " . $params[0] . " " . $params[1] . " " . $x . " " . $y . " " . $z; $rcon = new Rcon($host, $port, $password, $timeout); if ($rcon->connect()) { $rcon->send_command($result); // $rcon->send_command("spawnnamedmob Simon spider -97 78 228"); } if (strtolower($params[0]) == "jeff") { header("content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <Response> <Message>JEFF!! just sent <?php echo $params[0]; ?> the <?php echo $params[1]; ?> into battle!!</Message> </Response>