G'day,
I'm currently trying to get a input box with a submit button that puts the command into a string and executes it on a detached screen. Currently I have the following:
index.html
<form id="commandForm" method="post" action="command.php">
<input type="text" name="command" />
<input name="sendCommand" id="sendCommand" type="submit" value="Send" />
</form>
command.php
<?php
shell_exec(screen -S minecraft -p 0 -X stuff "$_'command'$(printf \\r)")
?>
In the screen command $_'command' is the text from the text box in the index page.
I'm missing some stuff in my PHP and I've spent quite a while looking and reading but I do not understand.
Is there any chance someone could help me out wih this one please?
Also I understand the security implications of shell_exec, this page will be hidden behind a login screen.