private function check_sessionid() { /* send reqid = 6 to the proxy */ $req_arr = array("req_id" => 6, "sessid" => $this->sessid); $res = proxy_send_command($req_arr); $response = json_decode($res, TRUE); //print_r($response); if (array_key_exists('admin', $response) && $response['admin'] != 0) { $this->maulid = $response['maul_id']; return TRUE; } return FALSE; }
require_once "../proxy.inc.php"; $auth_obj = new auth(); if(array_key_exists("adminkey", $_REQUEST)) $auth_obj->adminkey = $_REQUEST['adminkey']; if(array_key_exists("sessid", $_REQUEST)) $auth_obj->sessid = $_REQUEST['sessid']; if(!$auth_obj->admin_validate()) { ?> You are not authorized to view this page, or your session timed out. Please <a href="../maul_rcon_login.php">log in again.</a> <?php die(); } if(array_key_exists("proxyreset", $_POST)) { $req = array("sessid"=>$auth_obj->sessid, "req_id"=>7); $res = proxy_send_command($req); $res_arr = json_decode($res, TRUE); if($res_arr['status'] == 0) { die("Success! Close this window and log in to MAUL RCON again to continue."); } else { die("Error: unable to restart RCON proxy..."); } } if(array_key_exists("request", $_POST)) { $request = $_POST['request']; $server = new servers(); $server->name = $_POST['name']; $server->address = $_POST['address']; $server->port = $_POST['port'];
if ($maulid > 0) { $req_arr = array("req_id" => 0, "maul_id" => $maulid, "password" => $_POST['password']); $res = proxy_send_command($req_arr); setcookie("maul_rcon_username", $_POST['username']); die($res); } else { /* Failed auth check on the server side, delay to avoid hammering */ sleep(2); } die(json_encode($arr)); } if ($serverlist) { $req_arr = array("req_id" => 5, "sessid" => $sessid); $res = proxy_send_command($req_arr); die($res); } if ($command) { $req_arr = array("req_id" => 1, "sessid" => $sessid, "server_id" => $serverid, "command" => $command); $res = proxy_send_command($req_arr); die($res); } if ($getlog) { $req_arr = array("req_id" => 2, "sessid" => $sessid, "server_id" => $serverid); $res = proxy_send_command($req_arr); die($res); } if ($getstatus) { $req_arr = array("req_id" => 3, "sessid" => $sessid, "server_id" => $serverid); $res = proxy_send_command($req_arr); die($res); }