Andrew Bedno    Andrew@Bedno.com • 773-213-4578
 History   Kudos   Samples 

PHP
2002 - Ongoing  (23 Years)
PHP

Web-Based File Manager

Comprehensive web-based remote file manager written in PHP, with multiple view modes, text editing, upload features and much more. Evolved descendants of this are in use on multiple major sites.

include "global.php";
show_header("main");

print("<table border=0 width=100%>");
print("<tr>");
print("<td align=left>");
print("&nbsp;<a href='main.php?dir=".VIEWARG().SORTARG().SESSIONARG()."' title='CLICK HERE to return to the ROOT DIR'><font color=gray>$USER_DOMAIN</font></a><b> ");
$currdir_parts = $currsubdir;
$tok = strtok($currdir_parts."/","/");
$fullcurrsubdir = $tok;
while($tok) {
  print(" <a href="main.php?dir=".$fullcurrsubdir.VIEWARG().SORTARG().SESSIONARG().'" title="Change to dir: '.$fullcurrsubdir.'">'.$tok.'</a> /');
  $tok = strtok("/");
  $fullcurrsubdir .= '/'.$tok;
}
print("</b></td>\n");
print("<td align=right>");
print("User: <a href='index.htm' title='LOGOUT'><b>".$LOGIN_USER.'</b></a>');
print("</td>");
print("</tr>");
print("</table>\n");
print("<table border=1 cellPadding=2 cellSpacing=0 width=100% bordercolorlight="#aa77aa" bordercolordark="#fffff0">");
print("<tr>");
print("<td align=left BGCOLOR="#FFDDAA">");
if ( ($LOGIN_BLOCK == '*') || (strstr($LOGIN_BLOCK, ACTION_CHANGEDIR)) ) {
    print("<font color=gray><u>up dir</u></font>");
} else {
  if ($currsubdir != '') {
      $updirname = dirname($currsubdir);
      print("<a href="main.php?dir=".fix_slashes($updirname).VIEWARG().SORTARG().SESSIONARG()."" title='UP DIR'>");
      print('up dir</a>');
  } else {
      print("<font color=brown><u>up dir</u></font>");
  }
}
print("&nbsp;&#149;&nbsp");
if ( ($LOGIN_BLOCK == '*') || (strstr($LOGIN_BLOCK, ACTION_CREATEDIR)) ) {
  print("<font color=gray><u>new dir</u></font>");
} else {
  if (is_writable(phys_loc($currsubdir,''))) {
    print("<a href="JavaScript:cuwin('opwin',300,300,'newdir.php?dir=".$currsubdir.SESSIONARG()."')" title='NEW DIR'>");
    print("new dir</a>");
  } else {
    print("<font color=brown><u>new dir</u></font>");
  }
}
print("&nbsp;&#149;&nbsp");
if ( ($LOGIN_BLOCK == '*') || (strstr($LOGIN_BLOCK, ACTION_CREATEFILE)) ) {
    print("<font color=gray><u>new file</u></font>");
} else {
  if (is_writable(phys_loc($currsubdir,''))) {
    print("<a href="JavaScript:cuwin('opwin',0,0,'edit.php?dir=".$currsubdir.SESSIONARG()."')" title='NEW FILE'>");
    print("new file</a>");
  } else {
    print("<font color=brown><u>new file</u></font>");
  }
}
print("&nbsp;&#149;&nbsp");
if ( ($LOGIN_BLOCK == '*') || (strstr($LOGIN_BLOCK, ACTION_UPLOAD)) ) {
   print("<font color=gray><u>upload</u></font>");
} else {
  if (is_writable(phys_loc($currsubdir,''))) {
    print("<a href="JavaScript:cuwin('opwin',300,480,'upload.php?dir=".$currsubdir.SESSIONARG()."')" title='UPLOAD'>");
    print("upload</a>");
  } else {
    print("<font color=brown><u>upload</u></font>");
  }
}
print("&nbsp;&#149;&nbsp");
print("<a href="main.php?dir=".$currsubdir.VIEWARG().SORTARG().SESSIONARG()."" title='REFRESH'>refresh</a>");
print("</td>");
print("<form name='DIRMENU' method=POST align=top>");
print("<td align=left BGCOLOR="#FFDDAA" align=center>");
print("<select name='DIRTO' onChange='if (document.DIRMENU.DIRTO.options[document.DIRMENU.DIRTO.selectedIndex].value) { window.location = document.DIRMENU.DIRTO.options[document.DIRMENU.DIRTO.selectedIndex].value }' style='font-family: Arial; color: #000000; font-size: 10px'>\n");
print("<option value=''>CD...");
print("<option value='main.php?dir=".VIEWARG().SORTARG().SESSIONARG()."'>/");
print root_selector();
print("</select>");
print("</td></form>");
print("<td align=right BGCOLOR="#FFDDAA">");
print("<font face=Arial size=1>Sort:&nbsp;");
$maxSortMode = 2;
$SortModes[0] = "Name";
$SortModes[1] = "Date";
$SortModes[2] = "Size";
for ($sm_lp=0; $sm_lp <= $maxSortMode; $sm_lp++) {
  $sm_lp_c = strtolower(substr($SortModes[$sm_lp],0,1));
  if ( (! strstr($sortmode,$sm_lp_c)) ||
       ( (strstr($sortmode,$sm_lp_c)) &&
         (strstr($sortmode,'-')) ) ) {
    $sort_title = 'title="SORT BY '.strtoupper($SortModes[$sm_lp]).'"';
  } else {
    $sort_title = 'title="REVERSE SORT BY '.strtoupper($SortModes[$sm_lp]).'"';
  }
  if (strstr($sortmode,$sm_lp_c)) { 
    print("<a href='main.php?dir=".$currsubdir."&s=");
    if (! strstr($sortmode,'-')) { print '-'; }
    print($sm_lp_c.VIEWARG().SESSIONARG()."' ".$sort_title."><font color=");
    if (strstr($sortmode,'-')) { print 'red'; } else { print 'green'; }
    print(">".$SortModes[$sm_lp]."</font>");
  } else {
    print("<a href='main.php?dir=".$currsubdir."&s=".$sm_lp_c.VIEWARG().SESSIONARG()."' ".$sort_title.">");
    print($SortModes[$sm_lp]);
  }
  print("</a>&nbsp;");
}
print("&nbsp;&nbsp;");
print("View:&nbsp;");
$ViewModes[0] = "List";
$ViewModes[1] = "Icons";
$ViewModes[2] = "Thumbs";
$ViewModes[3] = "Photos";
for ($vm_lp=0; $vm_lp < count($ViewModes); $vm_lp++) {
  print("<a href='main.php?dir=".$currsubdir."&v=".$vm_lp.SORTARG().SESSIONARG()."'>");
  if ($vm_lp == $viewmode) { print("<font color=red>"); }
  print($ViewModes[$vm_lp]);
  if ($vm_lp == $viewmode) { print("</font>"); }
  print("</a>&nbsp;");
}
print("</font></td>");
print("</tr>");
print("</table>");
WriteLog('BROWSE','Sort='.$sortmode.' View='.$viewmode);
if ($viewmode == 1) {
  file_view_list(1);
} else {
  if ($viewmode == 2) {
    file_view_icon();
  } else {
    if ($viewmode == 3) {
      file_view_photo();
    } else {
      file_view_list(0);
    }
  }
}
show_footer();

CLIPPED...


 DOWNLOAD         < NEWER    OLDER >