Can you help me with RCONEM on the web? rcon password, I correctly, but it writes: BAD RCON ATTEMPT BY ...
Код:
<form method="post"><table>
<?php
$ip = "ip";
$port = "port";
$pass = "password";
$fp = fsockopen('udp://' . $ip, $port);
if (!$fp)
{
echo "OFFLINE");
fclose($fp);
}
else
{
$packet = 'SAMP';
$packet .= chr(strtok($ip, '.'));
$packet .= chr(strtok('.'));
$packet .= chr(strtok('.'));
$packet .= chr(strtok('.'));
$packet .= chr($port & 0xFF);
$packet .= chr($port >> 8 & 0xFF);
fwrite($fp, $packet.'i');
@fread($fp, 11);
stream_set_blocking($fp, TRUE);
stream_set_timeout($fp,0.5);
$info = stream_get_meta_data($fp);
$is_passworded = ord(fread($fp, 1));
$plr_count = ord(fread($fp, 2));
$max_plrs = ord(fread($fp, 2));
$strlen = ord(fread($fp, 4));
$hostname = htmlentities(@fread($fp, $strlen));
$strlen = ord(fread($fp, 4));
fwrite($fp, $packet.'c');
@fread($fp, 11);
@fclose($fp);
}
if(!$hostname)
{
echo "OFFLINE";
}
else
{
echo '<tr><td><center><b>RCON COMMAND</td><th><center><input type="text" name="cmd"></th><td><center><input id="input_submit" type="submit" name="submit" value="send"></td></tr>';
if($_POST["submit"])
{
$passlen = strlen($pass);
$cmd = $_POST['cmd']; if (!$cmd) Warning("no - command \n");
$cmdlen = strlen($cmd);
$packet = 'SAMP';
$packet .= chr(strtok($ip, '.')).chr(strtok('.')).chr(strtok('.')).chr(strtok('.'));
$packet .= chr($port & 0xFF).chr($port >> 8 & 0xFF);
$packet .= "x";
$packet .= chr($passlen & 0xFF).chr($passlen >> 8 & 0xFF).$pass;
$packet .= chr($cmdlen & 0xFF).chr($cmdlen >> 8 & 0xFF).$cmd;
$fp =fsockopen('udp://' . $ip, $port, $errno, $errstr);
fwrite($fp, $packet);
fclose($fp);
if(!$fp) echo "error"); else echo "send command";
}
}
?>