Esempio n. 1
0
<?php

ob_clean();
if ($_GET['cmd'] == "logout") {
    session_destroy();
    exit("<br>" . yes("You are logged out!"));
}
try {
    $Query = new SourceQuery();
    $Query->Connect($_SESSION['s'], $_SESSION['port'], SQ_TIMEOUT, SQ_ENGINE);
    $Query->setRconPassword($_SESSION['p']);
    $r = $Query->Rcon(trim($_GET['cmd']));
    $dictionary = array('§9' => '<span class="text-primary">', '§c' => '<span class="text-danger">', '§a' => '<span class="text-success">', '§0' => '', '§o' => '<span style="font-style:italic">', "\n" => '</br>', '§r' => '</span>');
    $r = str_replace(array_keys($dictionary), $dictionary, $r);
    exit($r);
} catch (Exception $e) {
    echo fail($e->getMessage());
}
Esempio n. 2
0
<div class="container">
      <form class="form-signin" role="form" action="/rcon/index.php" method="POST">
        <h2 class="form-signin-heading">Web RCON</h2>
<?php 
if (!empty($_POST)) {
    if (empty($_POST['s']) || empty($_POST['p']) || empty($_POST['port'])) {
        echo fail("All fields are required.");
    } else {
        try {
            $Query = new SourceQuery();
            $Query->Connect($_POST['s'], $_POST['port'], SQ_TIMEOUT, SQ_ENGINE);
            $Query->setRconPassword($_POST['p']);
            $_SESSION['s'] = $_POST['s'];
            $_SESSION['p'] = $_POST['p'];
            $_SESSION['port'] = $_POST['port'];
            header("Location: http://mcpe.me/rcon/index.php");
        } catch (Exception $e) {
            echo fail($e->getMessage());
        }
    }
}
?>
        <input type="text" class="form-control" placeholder="Hostname"  autofocus="" name="s" required="">
        <input type="text" class="form-control" placeholder="Port" required="" value="19132" name="port">
        <input type="password" class="form-control" placeholder="Password" required="" name="p">
        <button class="btn btn-lg btn-primary btn-block" type="submit">Connect Now</button>
      </form>

    </div>