I would like to send custom text by web to my game server throught this script, but i dunno how to define the text inside input
Any tip or suggestion or fix?
the script is:
<?php
function send_command($ip,$port,$rcon,$command) {
$fp = @fsockopen("udp://".$ip, $port, $errno, $errstr);
if ($fp){
$request = chr(1).chr(0).chr(242).chr(strlen($rcon)).$rcon.pack("S",strlen($command)).$command;
fwrite($fp, $request);
}
}
$name = "Owner";
echo "<input type='text' name='$msg'";
if (isset($_REQUEST['send'])) {
send_command("192.168.1.69",36963,"asdasd","say ©255255255".$name.": ".$msg);
}
?>
<html>
<form>
<input type="submit" value="send" name="send">
</form>
</html>
"Error "is:
Notice: Undefined variable: msg in D:\xampp\htdocs\test\index.php on line 11 Notice: Undefined variable: msg in D:\xampp\htdocs\test\index.php on line 14
Don't define your input's ID with a '$'. PHP interprets that as a variable. Name it 'msg'. You may then reference it with $_POST['msg']
or $_GET['msg']
, depending on how you sent it to the PHP file.