Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $auth = isset($_GET['key']) ? $_GET['key'] : 'wibble';
- $mcNick = isset($_GET['mcNick']) ? $_GET['mcNick'] : null;
- $twNick = isset($_GET['twNick']) ? $_GET['twNick'] : null;
- $twChan = isset($_GET['chan']) ? $_GET['chan'] : null;
- $action = isset($_GET['act']) ? $_GET['a'] : null;
- class User {
- public $twitchusername = "";
- public $minecraftusername = "";
- public $twitchchannel = "";
- }
- $user = new User();
- /*act=a&
- chan=Sithnar&
- twNick=$user&
- mcNick=$dummyormsg&
- */
- if($auth == $key)
- {
- if($mcNick !=null) {
- $mcNick = $_GET['mcNick'];
- $mcNick = preg_replace("/[^0-9a-zA-Z\_\- ]/m", "", $mcNick);
- $mcNick = preg_replace("/ /", "", $mcNick);
- }
- if(isset($_GET['act']))
- {
- $act = $_GET['act'];
- switch($act) {
- case 'a': $action = 'add '. $mcNick; break;
- case 'r': $action = 'remove ' . $mcNick; break;
- case 'l': $action = 'list'; break;
- default: $action = 'reload';
- }
- if($act == 'a')
- {
- $jsonasarray=array();
- $file = 'whitelist.json';
- $user->twitchusername = $twNick;
- $user->twitchchannel = $twChan;
- $user->minecraftusername = $mcNick;
- $jsonasarray=json_decode(file_get_contents($file));
- $jsonasarray[]=$user;
- $output=$jsonasarray;
- file_put_contents($file, json_encode($output));
- }
- }
- $servercmd = "whitelist $action";
- $host = 'localhost'; // Server host name or IP
- $port = 25569; // Port rcon is listening on
- $password = 'Test123'; // rcon.password setting set in server.properties
- $timeout = 3; // How long to timeout. Default 3
- $rcon = new Rcon($host, $port, $password, $timeout);
- if ($rcon->connect())
- {
- $rcon->send_command($servercmd);
- $response = $rcon->get_response();
- }
- else
- { print "Sorry whitelisting is unavailable at this time";}
- //*/
- /**/
- print "<pre>";
- $arr = get_defined_vars();
- print_r($arr);
- print "</pre>";
- print $response;
- #print "$_GET[twNick] Sucess! $_GET[mcNick] added";
- }
- return;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement