Zend - The PHP Company




Files and Directories

Add Code


LBN File Manager  

Type: application
Added by: musician214
Entered: 06/12/2003
Last modified: 02/11/2002
Rating: - (fewer than 3 votes)
Views: 7076
List All Entries in a Directory in Alphabetical Order. Create Directories, Upload Files, Rename Files and Directories, Delete Files and Directories, Edit Files, Set Permissions (modes) for Files and Directories.


<?php
header
("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0"false);
header("Pragma: no-cache");
 
ob_implicit_flush();
 
error_reporting(0);

//  First Create a New Directory in Your Main or Home Directory
//  Place This File in That New Directory
//  Create a Directory named images In Your New Directory
//  Download the images listed below
//  Place All of the Icon Images in the images directory

//**** THIS IS THE ONLY LINE THAT NEEDS TO CHANGE ****
    
$Home = ('/home/user/home/directory/');
//****   CHANGE TO CALL TO YOUR HOME DIRECTORY    ****
 
  
if (!$Path || $Path == './' || $Path == ''){
   
$Cur = ('');
   
$LinkUp = ('');
  }
  else{
   
$Cur = ($Path);
   
$LinkUp = ('<A href="'.$PHP_SELF.'?Path='.dirname($Cur).'/"><IMG src="images/icon_uplevel.gif" width="15" height="15" border="0"></A> <A href="'.$PHP_SELF.'?Path='.dirname($Cur).'/">Up One Level</A><BR>');
  }
 
$Dir = ($Home.$Cur);
  if (
$A == 'MakeDirectory'){
   
$Title = ('Creating Directories  LBN File Manager 1.0');
   
$Actions =('
    Enter New Directory Name:
    <INPUT type="hidden" name="A" value="MakeDir">
    <INPUT type="text" name="W" size="10">
    <FONT size="2">
    <INPUT type="submit" value="SUBMIT">
    </FONT>
   '
);
  }
  else if (
$A == 'UploadFile'){
   
$Title = ('Uploading Files  LBN File Manager 1.0');
   
$Actions =('
    Browse To Find A File On Your Computer:
    <INPUT type="file" name="userfile" size="10">
    <INPUT type="hidden" name="A" value="UploadAFile">
    <FONT size="2">
    <INPUT type="submit" value="SUBMIT">
    </FONT>
   '
);
  }
  else if (
$A == 'UploadAFile'){
   
$newname = ($userfile_name);
   
$newdir = ($Home.$Path);
   
$Actions = ('
              <A href="'
.$PHP_SELF.'?A=MakeDirectory&Path='.$Path.'">Create Directories</A>
             &nbsp; &nbsp; &nbsp; 
              <A href="'
.$PHP_SELF.'?A=UploadFile&Path='.$Path.'">Upload New File</A>
              '
);
         
do_upload($userfile,$newname,$newdir);
  }
  else if (
$A == 'QuickKey'){
   
$Actions = ('
     <A href="'
.$PHP_SELF.'?A=ExtKey&Path='.$Path.'">Extended Icon Key</A>
     &nbsp; &nbsp; 
     <A href="'
.$PHP_SELF.'?Path='.$Path.'">Close Icon Key</A>
   '
);
   
$Title = ('Quick Key LBN File Manager 1.0');
   
$Key = ('
  <TR>
    <TD align="center" Valign="top">
      <TABLE width="98%" border="1">
        <TR>
          <TD align="center">
            <TABLE width="85%" border="2">
              <TR>
                <TD align="center" Valign="middle" width="100%">
                 <FONT face="Times New Roman" size="4" color="#003D84"><B>
                  Icon Quick Key
                 </B></FONT>
                </TD>
              </TR>
            </TABLE>
          </TD>
        </TR>
        <TR>
          <TD align="left" width="15%">
           <FONT face="Times New Roman" size="2" color="#003D84">
            Icon 
            &nbsp; &nbsp; 
            Description
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_edit.gif" width="15" height="15" border="0" alt="Edit...">
            &nbsp; &nbsp;
            Click To View and/or Edit File Source Code 
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_rename.gif" width="15" height="15" border="0" alt="Rename...">
            &nbsp; &nbsp;
            Click To Rename File or Directory
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_delete.gif" width="15" height="15" border="0" alt="Delete...">
            &nbsp; &nbsp;
            Click To Delete File or Direectory 
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_permsry.gif" width="10" height="10" border="0" alt="Directory/File Is Readable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Readable 
            &nbsp; &nbsp; &nbsp;&nbsp;
            <IMG src="images/icon_permsrn.gif" width="10" height="10" border="0" alt="Directory/File Is Not Readable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Not Readable 
            Click To Change
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_permswy.gif" width="10" height="10" border="0" alt="Directory/File Is Writeable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Writeable
            &nbsp; &nbsp; &nbsp;
            <IMG src="images/icon_permswn.gif" width="10" height="10" border="0" alt="Directory/File Is Not Writeable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Not Writeable 
            Click To Change
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_permsey.gif" width="10" height="10" border="0" alt="File Is Executable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Executable
            &nbsp; &nbsp; 
            <IMG src="images/icon_permsen.gif" width="10" height="10" border="0" alt="File Is Not Executable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Not Executable
            Click To Change
           </FONT>
          </TD>
        </TR>
      </TABLE>
    </TD>
  </TR>
   '
);
  }



  else if (
$A == 'ExtKey'){
   
$Actions = ('
     <A href="'
.$PHP_SELF.'?A=QuickKey&Path='.$Path.'">Icon Quick Key</A>
     &nbsp; &nbsp; 
     <A href="'
.$PHP_SELF.'?Path='.$Path.'">Close Icon Key</A>
   '
);
   
$Title = ('Extended Key LBN File Manager 1.0');
   
$Key = ('
  <TR>
    <TD align="center" Valign="top">
      <TABLE width="98%" border="1">
        <TR>
          <TD align="center">
            <TABLE width="85%" border="2">
              <TR>
                <TD align="center" Valign="middle" width="100%">
                 <FONT face="Times New Roman" size="4" color="#003D84"><B>
                  Extended Icon Key
                 </B></FONT>
                </TD>
              </TR>
            </TABLE>
          </TD>
        </TR>
        <TR>
          <TD align="left" width="15%">
           <FONT face="Times New Roman" size="2" color="#003D84">
            Icon 
            &nbsp; &nbsp; 
            Description
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_folder.gif" width="15" height="15" border="0" alt="Directory: ...">
            &nbsp; &nbsp;
            Entry Is A Directory
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_html.gif" width="15" height="15" border="0" alt="File: ...">
            &nbsp; &nbsp;
            Entry Is An HTML file &nbsp; &nbsp; Extensions: .htm, .html, shtml
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_php.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is A PHP file  &nbsp; &nbsp; Extensions: .php
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_text.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is A Text file  &nbsp; &nbsp; Extensions: .txt
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_image.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is A Picture file  &nbsp; &nbsp; Extensions: .gif, .jpg, .jpeg, .bmp, .png
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_javascript.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is A JavaScript file  &nbsp; &nbsp; Extensions: .js
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_msoffice.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is A MS Office file  &nbsp; &nbsp; Extensions: .doc, .wks, .mdb, .xls, .ppt
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_pdf.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is A PDF file  &nbsp; &nbsp; Extensions: .pdf
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_music.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is A Music file  &nbsp; &nbsp; Extensions: .wav, .mid, .mp2, .mp3
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_movie.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is A Movie file  &nbsp; &nbsp; Extensions: .mpg, .mpeg, .avi, .wmv
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_swflash.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is A Shockwave Flash file  &nbsp; &nbsp; Extensions: .dcr
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_zip.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is A Zip file  &nbsp; &nbsp; Extensions: .zip
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_exe.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is An EXE file  &nbsp; &nbsp; Extensions: .exe
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_default.gif" width="15" height="15" border="0" alt="File:...">
            &nbsp; &nbsp;
            Entry Is An Un-documented file type 
           </FONT>
          </TD>
        </TR>        
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_edit.gif" width="15" height="15" border="0" alt="Edit...">
            &nbsp; &nbsp;
            Click To View and/or Edit File Source Code 
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_rename.gif" width="15" height="15" border="0" alt="Rename...">
            &nbsp; &nbsp;
            Click To Rename File or Directory
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_delete.gif" width="15" height="15" border="0" alt="Delete...">
            &nbsp; &nbsp;
            Click To Delete File or Direectory 
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_permsry.gif" width="10" height="10" border="0" alt="Directory/File Is Readable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Readable 
            &nbsp; &nbsp; &nbsp;&nbsp;
            <IMG src="images/icon_permsrn.gif" width="10" height="10" border="0" alt="Directory/File Is Not Readable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Not Readable 
            Click To Change
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_permswy.gif" width="10" height="10" border="0" alt="Directory/File Is Writeable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Writeable
            &nbsp; &nbsp; &nbsp;
            <IMG src="images/icon_permswn.gif" width="10" height="10" border="0" alt="Directory/File Is Not Writeable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Not Writeable 
            Click To Change
           </FONT>
          </TD>
        </TR>
        <TR>
          <TD align="left">
           <FONT face="Times New Roman" size="2" color="#003D84">
            <IMG src="images/icon_permsey.gif" width="10" height="10" border="0" alt="File Is Executable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Executable
            &nbsp; &nbsp; 
            <IMG src="images/icon_permsen.gif" width="10" height="10" border="0" alt="File Is Not Executable Click To Change Permissions">
            &nbsp; &nbsp;
            Entry Is Not Executable
            Click To Change
           </FONT>
          </TD>
        </TR>
      </TABLE>
    </TD>
  </TR>
   '
);
  }





  else if (
$A == 'EditFile'){
   
$FileO fopen($W"r");
   
$FileR fread($FileOfilesize($W));
    
fclose($FileO);
   
$Title = ('Editing '.basename($W).' LBN File Manager 1.0');
   
$Actions =('
    Edit Code For <B>'
.basename($W).':</B><BR>
    <INPUT type="hidden" name="A" value="EditAFile">
    <INPUT type="hidden" name="FileName" value="'
.$W.'">
    <TEXTAREA name="FileCode" rows="15" cols="55" noWrap wrap=off 750px>'
.$FileR.'</TEXTAREA>
    <FONT size="2">
    <INPUT type="submit" value="SUBMIT">
    </FONT>
   '
);
  }
  else if (
$A == 'RenameDir'){
   
$Title = ('Renaming '.basename($W).' LBN File Manager 1.0');
   
$Actions =('
    Enter New Name For <B>'
.basename($W).':</B>
    <INPUT type="hidden" name="A" value="RenameADirectory">
    <INPUT type="hidden" name="Cd" value="'
.$W.'">
    <INPUT type="text" name="Nd" size="10" value="'
.basename($W).'">
    <FONT size="2">
    <INPUT type="submit" value="SUBMIT">
    </FONT>
   '
);
  }
  else if (
$A == 'RenameFile'){
   
$Title = ('Renaming '.basename($W).' LBN File Manager 1.0');
   
$Actions =('
    Enter New Name For <B>'
.basename($W).':</B>
    <INPUT type="hidden" name="A" value="RenameAFile">
    <INPUT type="hidden" name="Cf" value="'
.$W.'">
    <INPUT type="text" name="Nf" size="10" value="'
.basename($W).'">
    <FONT size="2">
    <INPUT type="submit" value="SUBMIT">
    </FONT>
   '
);
  }
  else if (
$A == 'ChangePermissions'){
   
$Title = ('Changing Permissions For '.basename($W).' LBN File Manager 1.0');
   
$Actions =('
    <INPUT type="hidden" name="A" value="SetPerms">
    <INPUT type="hidden" name="ChMFile" value="'
.$W.'">
    <INPUT type="checkbox" name="Read" value="4" checked> Make <B>'
.basename($W).'</B> Readable<BR>
    <INPUT type="checkbox" name="Write" value="2"> Make <B>'
.basename($W).'</B> Writeable<BR>
    <INPUT type="checkbox" name="Exec" value="1"> Make <B>'
.basename($W).'</B> Executable<BR>
    <FONT size="2">
    <INPUT type="submit" value="SUBMIT">
    </FONT>
   '
);
  }
  else{
   
$Title = ('LBN File Manager 1.0');
   
$Actions = ('
             <A href="'
.$PHP_SELF.'?A=QuickKey&Path='.$Path.'">Icon Quick Key</A>
             &nbsp; &nbsp; &nbsp; 
              <A href="'
.$PHP_SELF.'?A=MakeDirectory&Path='.$Path.'">Create Directories</A>
             &nbsp; &nbsp; &nbsp; 
              <A href="'
.$PHP_SELF.'?A=UploadFile&Path='.$Path.'">Upload New File</A>
   '
);
  }
  if (
$A == 'MakeDir'){
   
$NewDirName = ($Dir.$W.'/');
   
MakeDir($NewDirName);
  }
  if (
$A == 'EditAFile'){
    
$NewCode = ($FileCode);
    
$OpenFile fopen($FileName'w');
     
fputs($OpenFile,stripslashes($NewCode));  
     
fclose($OpenFile); 
    
$LastAction = ('<CENTER><B>'.basename($FileName).'</B> Has Been Updated.</CENTER>');
  }
  if (
$A == 'RenameADirectory'){
   
RNdir($Cd,$Home,$Path,$Nd);
  }
  if (
$A == 'RenameAFile'){
   
RNfile($Cf,$Home,$Path,$Nf);
  }
  if (
$A == 'DelDir'){
   
DeleteDir($W);
  }
  if (
$A == 'DelFile'){
   
DeleteFile($W);
  }
  if (
$A == 'SetPerms'){
   
$Mode = ($Read+$Write+$Exec);
    if (
is_dir($ChMFile)){
     if (
$Mode === 7){
      
chmod($ChMFile,0777);
     }
     else if (
$Mode === 6){
      
chmod($ChMFile,0777);
     }
     else if (
$Mode === || $Mode === 4){
      
chmod($ChMFile,0555);
     }
     else if (
$Mode === || $Mode === 2){
      
chmod($ChMFile,0333);
     }
     else if (
$Mode === 1){
      
chmod($ChMFile,0111);
     }
    }
    else{
     if (
$Mode === 7){
      
chmod($ChMFile,0777);
     }
     else if (
$Mode === 6){
      
chmod($ChMFile,0666);
     }
     else if (
$Mode === 5){
      
chmod($ChMFile,0555);
     }
     else if (
$Mode === 4){
      
chmod($ChMFile,0444);
     }
     else if (
$Mode === 3){
      
chmod($ChMFile,0333);
     }
     else if (
$Mode === 2){
      
chmod($ChMFile,0222);
     }
     else if (
$Mode === 1){
      
chmod($ChMFile,0111);
     }
     else{
      
chmod($ChMFile,0777);
     }
    }
  }

  function 
do_upload($filename,$newname,$tardir){
   
$file = ($filename);
   
$new_file_name = ($tardir.$newname);
    if (!
copy($file$new_file_name)){
     return;
    }
  }
  function 
MakeDir($NewDirName){
   
$NewDir = ($NewDirName);
    
mkdir($NewDir,0777);
  }
  function 
DeleteDir($W){
   
$DirToDelete = ($W);
    
rmdir($DirToDelete);
  }
  function 
DeleteFile($W){
   
$FileToDelete = ($W);
    
unlink($FileToDelete);
  }
  function 
RNdir($Cd,$Home,$Path,$Nd){
   if (!
$Cd || !$Nd){
   return;
   }
   else{
     
rename($Cd,$Home.$Path.$Nd);
   }
  }
  function 
RNfile($Cf,$Home,$Path,$Nf){
   if (!
$Cf || !$Nf){
   return;
   }
   else{
    
rename($Cf,$Home.$Path.$Nf);
   }
  }
?>
<HTML>
<HEAD>
<TITLE><? echo ($Title?></TITLE>
</HEAD>
<BODY bgcolor="#003D84" text="#FFFFFF" link="#003D84" Alink="#FF0000" Vlink="#003D84">
<CENTER>
<TABLE bgcolor="#CDBAA3" width="100%" height="95%" border="5" bordercolor="#003D84" cellpadding="0" cellspacing="2">
  <TR>
    <TD align="center" Valign="top" height="30">
<? echo ('<FORM method="post" action="'.$PHP_SELF.'?Path='.$Path.'" enctype="multipart/form-data">'?>
      <TABLE width="75%" border="3">
        <TR>
          <TD align="center" Valign="middle" width="100%">
           <FONT face="Times New Roman" size="5" color="#003D84"><B>
            Lima Business Net File Manager &nbsp; &nbsp; <I>Version 1.0</I>
           </B></FONT>
          </TD>
        </TR>
      </TABLE>
    </TD>
  </TR>
  <TR>
    <TD align="left" Valign="top" height="10%">
      <TABLE width="100%" height="100%">
        <TR>
          <TD align="left" Valign="top">
           <FONT face="Times New Roman" size="3" color="#003D84">
            <? echo ('
             Current Directory:
             <B>'
.$Cur.'</B>
             <BR>
             '
.$Actions.'
             '
); 
            
?>
           </FONT>
          </TD>
        </TR>
      </TABLE>
    </TD>
  </TR>
  <? echo ($Key); ?>
  <TR>
    <TD align="center" Valign="top" height="280">
      <TABLE width="100%" height="100%" border="1">
        <TR>
          <TD align="left" Valign="top" width="40%" height="275">
            <? echo ("n".$LinkUp."n"); ?>
            <TABLE width="100%" border="0">
            <?
             $OpenDirectory 
opendir($Dir);
              while (
false !== ($file readdir($OpenDirectory))) {
               if (
is_readable($Dir.$file)){
                
$PermsR =('<A href="'.$PHP_SELF.'?A=ChangePermissions&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_permsry.gif" width="10" height="10" border="0" alt="'.$file.' Is Readable Click To Change Permissions"></A>');
               }
               else{
                
$PermsR = ('<A href="'.$PHP_SELF.'?A=ChangePermissions&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_permsrn.gif" width="10" height="10" border="0" alt="'.$file.' Is Not Readable Click To Change Permissions"></A>');
               }
               if (
is_writeable($Dir.$file)){
                
$PermsW =('<A href="'.$PHP_SELF.'?A=ChangePermissions&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_permswy.gif" width="10" height="10" border="0" alt="'.$file.' Is Writeable Click To Change Permissions"></A>');
               }
               else{
                
$PermsW = ('<A href="'.$PHP_SELF.'?A=ChangePermissions&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_permswn.gif" width="10" height="10" border="0" alt="'.$file.' Is Not Writeable Click To Change Permissions"></A>');
               }
               if (
is_dir($Dir.$file) && $file !== '.' && $file !== '..'){
                
$DirList[] = ('<TR><TD align="left"><FONT face="Times New Roman" size="3"><A href="'.$PHP_SELF.'?Path='.$Cur.$file.'/"><IMG src="images/icon_folder.gif" width="15" height="15" border="0" alt="Directory: '.$file.'"></A> <A href="'.$PHP_SELF.'?Path='.$Cur.$file.'/">'.$file.'</A></FONT></TD><TD align="right" Valign="bottom"><A href="'.$PHP_SELF.'?A=RenameDir&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_rename.gif" width="15" height="15" border="0" alt="Rename '.$file.'"></A> <A href="'.$PHP_SELF.'?A=DelDir&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_delete.gif" width="15" height="15" border="0" alt="Delete '.$file.'"></A>  '.$PermsR.' '.$PermsW.'</TD></TR>'."n");
               }
               else{
                
$DirList[] = ('');
               }
              }
              
closedir($OpenDirectory); 
                
natcasesort($DirList);
                
reset($DirList);
                
$Dirs = (array_values($DirList));
              for (
$i=0;$i<=5000;$i++){
               
print_r ($Dirs[$i]);
              }
            
?>
            </TABLE>
          </TD>
          <TD width="2%" bgcolor="#003D84">
           <BR>
          </TD>
          <TD align="left" Valign="top" width="58%" height="275">
            <TABLE width="100%" border="0">
            <? 
             
echo "n";
             
$OpenDirectory opendir($Dir);
              while (
false !== ($file readdir($OpenDirectory))) {
               if (
is_executable($Dir.$file)){
                
$PermsE = ('<A href="'.$PHP_SELF.'?A=ChangePermissions&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_permsey.gif" width="10" height="10" border="0" alt="'.$file.' Is Executable Click To Change Permissions"></A>');
               }
               else{
                
$PermsE = ('<A href="'.$PHP_SELF.'?A=ChangePermissions&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_permsen.gif" width="10" height="10" border="0" alt="'.$file.' Is Not Executable Click To Change Permissions"></A>');
               }
               if (
is_readable($Dir.$file)){
                
$PermsR = ('<A href="'.$PHP_SELF.'?A=ChangePermissions&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_permsry.gif" width="10" height="10" border="0" alt="'.$file.' Is Readable Click To Change Permissions"></A>');
               }
               else{
                
$PermsR = ('<A href="'.$PHP_SELF.'?A=ChangePermissions&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_permsrn.gif" width="10" height="10" border="0" alt="'.$file.' Is Not Readable Click To Change Permissions"></A>');
               }
               if (
is_writeable($Dir.$file)){
                
$PermsW = ('<A href="'.$PHP_SELF.'?A=ChangePermissions&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_permswy.gif" width="10" height="10" border="0" alt="'.$file.' Is Writeable Click To Change Permissions"></A>');
               }
               else{
                
$PermsW = ('<A href="'.$PHP_SELF.'?A=ChangePermissions&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_permswn.gif" width="10" height="10" border="0" alt="'.$file.' Is Not Writeable Click To Change Permissions"></A>');
               }
              
$FType pathinfo($Dir.$file);
              
$FileType strtolower($FType[extension]);
               if (
$FileType == 'htm' || $FileType == 'html' || $FileType == 'shtml'){
                
$Icon = ('icon_html.gif');
               }
               else if (
$FileType == 'php'){
                
$Icon = ('icon_php.gif');
               }
               else if (
$FileType == 'txt'){
                
$Icon = ('icon_text.gif');
               }
               else if (
$FileType == 'gif' || $FileType == 'jpg' || $FileType == 'jpeg' || $FileType == 'bmp' || $FileType == 'png'){
                
$Icon = ('icon_image.gif');
               }
               else if (
$FileType == 'js'){
                
$Icon = ('icon_javascript.gif');
               }
               else if (
$FileType == 'doc' || $FileType == 'wks' || $FileType == 'mdb' || $FileType == 'xls' || $FileType == 'ppt'){
                
$Icon = ('icon_msoffice.gif');
               }
               else if (
$FileType == 'pdf'){
                
$Icon = ('icon_pdf.gif');
               }
               else if (
$FileType == 'wav' || $FileType == 'mid' || $FileType == 'mp2' || $FileType == 'mp3'){
                
$Icon = ('icon_music.gif');
               }
               else if (
$FileType == 'mpg' || $FileType == 'mpeg' || $FileType == 'avi' || $FileType == 'wmv'){
                
$Icon = ('icon_movie.gif');
               }
               else if (
$FileType == 'dcr'){
                
$Icon = ('icon_swflash.gif');
               }
               else if (
$FileType == 'hlp' || $FileType == 'help'){
                
$Icon = ('icon_help.gif');
               }
               else if (
$FileType == 'zip'){
                
$Icon = ('icon_zip.gif');
               }
               else if (
$FileType == 'exe'){
                
$Icon = ('icon_exe.gif');
               }
               else{
                
$Icon = ('icon_default.gif');
               }
               if (
is_file($Dir.$file)){
                
$FileList[] = ('<TR><TD align="left" Valign="top"><FONT face="Times New Roman" size="3"><A href="../'.$Cur.$file.'" target="_new"><IMG src="images/'.$Icon.'" width="15" height="15" border="0" alt="File: '.$file.'"></A> <A href="../'.$Cur.$file.'" target="_new">'.$file.'</A></FONT></TD><TD align="right" Valign="bottom"><A href="'.$PHP_SELF.'?A=EditFile&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_edit.gif" width="15" height="15" border="0" alt="Edit '.$file.'"></A> <A href="'.$PHP_SELF.'?A=RenameFile&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_rename.gif" width="15" height="15" border="0" alt="Rename '.$file.'"></A> <A href="'.$PHP_SELF.'?A=DelFile&W='.$Dir.$file.'&Path='.$Path.'"><IMG src="images/icon_delete.gif" width="15" height="15" border="0" alt="Delete '.$file.'"></A>  '.$PermsR.' '.$PermsW.' '.$PermsE.'</TD></TR>'."n");
               }
               else{
                
$FileList[] = ('');
               }
              }
              
closedir($OpenDirectory); 
              
natcasesort($FileList);
             
$Files = (array_values($FileList));
              for (
$i=0;$i<=3000;$i++){
               
print_r ($Files[$i]);
              }
            
?>    
            </TABLE>
          </TD>
        </TR>
      </TABLE>
      </FORM>
    </TD>
  </TR>
</TABLE>
<CENTER>
</BODY>
</HTML>


Usage Example


Be Sure To Download The Icon Images
http://www.limabusinessnet.com/fmanager/images/icon_folder.gif
http://www.limabusinessnet.com/fmanager/images/icon_html.gif
http://www.limabusinessnet.com/fmanager/images/icon_php.gif
http://www.limabusinessnet.com/fmanager/images/icon_text.gif
http://www.limabusinessnet.com/fmanager/images/icon_image.gif
http://www.limabusinessnet.com/fmanager/images/icon_javascript.gif
http://www.limabusinessnet.com/fmanager/images/icon_msoffice.gif
http://www.limabusinessnet.com/fmanager/images/icon_pdf.gif
http://www.limabusinessnet.com/fmanager/images/icon_music.gif
http://www.limabusinessnet.com/fmanager/images/icon_movie.gif
http://www.limabusinessnet.com/fmanager/images/icon_swflash.gif
http://www.limabusinessnet.com/fmanager/images/icon_zip.gif
http://www.limabusinessnet.com/fmanager/images/icon_exe.gif
http://www.limabusinessnet.com/fmanager/images/icon_default.gif
http://www.limabusinessnet.com/fmanager/images/icon_edit.gif
http://www.limabusinessnet.com/fmanager/images/icon_rename.gif
http://www.limabusinessnet.com/fmanager/images/icon_delete.gif
http://www.limabusinessnet.com/fmanager/images/icon_permsry.gif
http://www.limabusinessnet.com/fmanager/images/icon_permsrn.gif
http://www.limabusinessnet.com/fmanager/images/icon_permswy.gif
http://www.limabusinessnet.com/fmanager/images/icon_permswn.gif
http://www.limabusinessnet.com/fmanager/images/icon_permsey.gif
http://www.limabusinessnet.com/fmanager/images/icon_permsen.gif


Rate This Script





Search



This Category All Categories