I have 2 servers. First web server another linux server. On web server I write php script which connected to linux server and run command after user input. And in this case command which executes on linux server not same. For ex.:
<input type="text" name="input">
....
$user_input = $_POST["input"]
....
if (!($stream = ssh2_exec($con, "cat $user_input | grep some_text"))) {
echo "fail: unable to execute command\n";
}
Now I must allow user only one command with changable variable. User can give only for ex. "cat" and "grep" commands , but "$user_input" changes every time. Is there any way to solve situation?