function GetActions($addr, $port) { $in = json_encode(array('cmd' => 'listactions')); $message = sendcmd($in, $addr, $port); $obj = json_decode($message); $dat = $obj->{'data'}; return $dat; }
function LaunchActionOnOff($actID, $value, $addr, $port) { $in = json_encode(array('cmd' => 'executeactions', 'id' => $actID, 'value1' => $value)); $message = sendcmd($in, $addr, $port); $obj = json_decode($message, true); $dat = $obj['data']; return $dat['error']; }
function get_load($server) { $context = stream_context_create(); $result = stream_context_set_option($context, 'ssl', 'ciphers', 'ADH'); // SO this timeout seems to not work at all... Ints are also not working. I hate php $f = @stream_socket_client("ssl://{$server}:5666", $errno, $errstr, TIMEOUT, STREAM_CLIENT_CONNECT, $context); $out = false; if ($f) { stream_set_timeout($f, TIMEOUT); // Not sure if needed... php docs are stupid $out = sendcmd("check_load", $f); fclose($f); } return $out; }
#! /usr/bin/php <?php //lets look for arg if (sizeof($argv) < 2) { sendcmd('-h'); die; } for ($i = 1; $i < sizeof($argv); $i++) { if ($i == 1) { $cstring = $argv[$i]; } else { $cstring .= " " . $argv[$i]; } } sendcmd($cstring); /*switch ($argv[1]) { case 'test': sendcmd('test'); break; case '-D': setsock(); $GLOBALS['debug'] = false; main(); break; default: //showusage(); echo "thanks for playing\n\n"; return; break; }*/
<?php include "functions.php"; $data = pack("VV", 1, 03) . $config["server_rcon"] . chr(0) . '' . chr(0); $data = pack("V", strlen($data)) . $data; fwrite($conn, $data, strlen($data)); $size = @fread($conn, 4); sendcmd($conn, $_POST["cmd"]); echo $_POST["cmd"];