note 83831 added to function.system
| From: | gregui at gmail dot com | Date: | Fri, 13 Jun 2008 21:46:07 +0000 |
| Subject: | note 83831 added to function.system | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140421@lists.php.net to get a copy of this message | ||
ssh in web:
<?php
ob_start();
$path = str_replace("\\\\", "\\", $_POST["path"]);
$command = $_POST["command"];
if (strlen($path) > 0) {
chdir($path);
} else {
$path = getcwd();
}
$out = "";
if (strlen($command) > 0) {
if (substr($command,0, 3) == "cd ") {
system($command."
pwd");
$path = ob_get_contents();
ob_clean();
echo $path;
chdir($path);
system("ls -l");
$out = ob_get_contents();
ob_clean();
} else {
system($command);
$out = ob_get_contents();
ob_clean();
}
}
//upload to current path
if (strlen($_FILES["filename"]["name"]) > 0) {
move_uploaded_file($_FILES["filename"]["tmp_name"],
$path."/".$_FILES["filename"]["name"]);
}
?>
<html>
<body>
<form action="#" method="POST" enctype="multipart/form-data">
current path: <input type="text" id="path" name="path"
size="80" value="<?=$path?>"/><br/>
last command: <strong><?=$command?></strong><br/>
<strong>execute:</strong><br/>
<input type="text" id="command" name="command"
size="100" />
<input type="submit" name="submit"
value="execute"/><br/>
send to current path:<br/>
<input type="file" name="filename" id="filename" />
</form>
<textarea cols="90" rows="22"><?=$out?></textarea>
</body>
</html>
----
Server IP: 69.147.83.197
Probable Submitter: 201.47.14.231
----
Manual Page -- http://www.php.net/manual/en/function.system.php
Edit -- https://master.php.net/note/edit/83831
Del: integrated -- https://master.php.net/note/delete/83831/integrated
Del: useless -- https://master.php.net/note/delete/83831/useless
Del: bad code -- https://master.php.net/note/delete/83831/bad+code
Del: spam -- https://master.php.net/note/delete/83831/spam
Del: non-english -- https://master.php.net/note/delete/83831/non-english
Del: in docs -- https://master.php.net/note/delete/83831/in+docs
Del: other reasons-- https://master.php.net/note/delete/83831
Reject -- https://master.php.net/note/reject/83831
Search -- https://master.php.net/manage/user-notes.php