dasun101

Untitled

Dec 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.37 KB | None | 0 0
  1. <?php
  2.                 if(isset($_GET['selectedFolder']))
  3.                 {
  4.                     if($_GET['selectedFolder'] != "")
  5.                     {
  6.                         $_SESSION['selectedFolder'] = $_GET['selectedFolder'];
  7.                    
  8.                         $selectedFolder = $_GET['selectedFolder'];
  9.  
  10.                         echo
  11.                         '
  12.                            <div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 tableDivBorder" style="margin-left:20px;">
  13.                                <table class="table" id="folderContentTable">
  14.                                   <thead>
  15.                                    <tr>
  16.                                      <th scope="col"><input type="checkbox" id="checkAll" /></th>
  17.                                      <th scope="col">File Name</th>
  18.                                      <th scope="col">File Size (KB)</th>
  19.                                      <th scope="col">Last Modified Date</th>
  20.                                    </tr>
  21.                                  </thead>
  22.                                  <tbody>
  23.                                    ';
  24.                                     try{
  25.                                         $path = "uploads/".$_SESSION['username']."/$selectedFolder";
  26.                                         $pathTemp = "uploads/".$_SESSION['username']."/$selectedFolder/";
  27.                                         $files = array_values(array_diff(scandir($path), array('..', '.')));
  28.                                         foreach ($files as &$value) {
  29.                                             echo '<tr><td><input type="checkbox" id="checkItem" value="'.$pathTemp.$value.'"/></td><td>'. $value .' </td>';
  30.                                             $filesize = filesize($pathTemp.'/'.$value);
  31.                                             echo '<td>'.round($filesize / 1024, 2).'</td><td>';
  32.                                             echo date("F d Y",filemtime($pathTemp.'/'.$value)).'</td>';
  33.                                         }
  34.                                     }catch(Exception $e){
  35.  
  36.                                     }
  37.                         echo        '
  38.                                  </tbody>
  39.                                  <tfoot>
  40.                                    <tr>
  41.                                      <td>
  42.                                      </td>
  43.                                      <td>
  44.                                        <button type="button" class="btn btn-primary" name="uploadBtn" id="uploadBtn" data-toggle="modal" data-target="#uploadFormModal">Upload</button>
  45.                                        <button type="button" class="btn btn-danger" name="deleteBtn" id="deleteBtn">Delete</button>
  46.                                      </td>
  47.                                    </tr>
  48.                                  </tfoot>
  49.                                </table>
  50.                            </div>
  51.                        ';
  52.                     }
  53.                     else
  54.                     {
  55.                         if (checkFolderHasFiles("uploads/".$_SESSION['username']."/"))
  56.                         {
  57.                             echo '<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9" style="height:80vh;"><div class="typewriterStyle"><div id="typewriteTextHaveFolder"></div></div></div>';
  58.                         }
  59.                         else{
  60.                             echo '<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9" style="height:80vh;"><div class="typewriterStyle"><p>Your space is empty.</br> Create a folder to start..</P></div></div>';
  61.                         }
  62.                        
  63.                     }
  64.                    
  65.                 }else
  66.                     {
  67.                         if (checkFolderHasFiles("uploads/".$_SESSION['username']."/"))
  68.                         {
  69.                             echo '<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9" style="height:80vh;"><div class="typewriterStyle"><div id="typewriteTextHaveFolder"></div></div></div>';
  70.                         }
  71.                         else{
  72.                             echo '<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9" style="height:80vh;"><div class="typewriterStyle"><p>Your space is empty.</br> Create a folder to start..</P></div></div>';
  73.                         }
  74.                     }
  75.             ?>
Advertisement
Add Comment
Please, Sign In to add comment