接:
<!--
body {
        font-family: "宋体";
        font-size: 12px;
        margin-left: 0px;
        margin-top: 0px;
}
table {
        font-family: "宋体";
        font-size: 12px;
        text-decoration: none;
}
.bold_blue {
        color: #003399;
        font-weight: bold;
}
input {
        border-right-width: 0.1mm;
        border-bottom-width: 0.1mm;
        border-top-style: none;
        border-right-style: solid;
        border-bottom-style: solid;
        border-left-style: none;
        border-right-color: #CCCCCC;
        border-bottom-color: #CCCCCC;
}
-->
</style>
</head><body>
<table width="770" border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>
    <td align="right" bgcolor="#BCBCBC"><font color="White">PHP版本:</font><font color=red><?php echo PHP_VERSION;?></font> &nbsp;&nbsp;&nbsp;<font color="White"> 服务器:</font><font color=red><?php echo php_uname();?></font></td>
  </tr>
  <tr>
    <td bgcolor="#DDDDDD"><table width="100%" height="100%" border="0" cellpadding="5" cellspacing="2" bgcolor="#F5F5F5">
      <tr><form name="form1" method="post" action="">
        <td><span class="bold_blue"><strong>目录选择</strong>:</span>          <input name="path" type="text" id="path">
          <input type="submit" name="Submit" value="跳 转"></td></form>
      </tr>
      <tr><form name="form2" method="post" action="">
        <td><span class="bold_blue"><strong>新建目录</strong>:</span>          <input name="dirname" type="text" id="dirname">
          <input type="submit" name="Submit" value="建 立"></td></form>
      </tr><form name="form3" method="post" action="" enctype="multipart/form-data">
      <tr>
        <td><span class="bold_blue"><strong>上传文件</strong>:</span>          <input name="upfiles" type="file" id="upfiles">
          </td>
      </tr>
      <tr>
        <td><span class="bold_blue"><strong> 新文件名</strong>:</span>          <input name="fname" type="test" id="fname">
          <input type="submit" name="upload" value="上 传"></td>
      </tr></form>
      <tr>
        <td><span class="bold_blue">当前路径:</span><font color=red><?php echo $CurrentPath;?></font></td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td bgcolor="#DDDDDD"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td bgcolor="#BCBCBC"><strong>子目录</strong></td>
      </tr>
      <tr>
      <td>
      <table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#EFEFEF">
      <?php
$fso=@opendir($CurrentPath);
while ($file=@readdir($fso)) {
        $fullpath        = "$CurrentPath/$file";
        $is_dir                = @is_dir($fullpath);
        if($is_dir=="1"){
        if($file!=".."&&$file!=".")        {
                echo "<tr bgcolor=\"#EFEFEF\">\n";
                echo "  <td>【目录】 <a href=\"?path=".urlencode($CurrentPath)."/".urlencode($file)."\">$file</a></td>\n";
                echo "</tr>\n";
        } else {
                if($file=="..")
                {
                        echo "<tr bgcolor=\"#EFEFEF\">\n";
                        echo "<td>【上级】 <a href=\"?path=".urlencode($CurrentPath)."/".urlencode($file)."\">上级目录</a></td>";
                        echo "</tr>\n";
                }
        }
        }
}
@closedir($fso);
?>
</table>
</td>
</tr>
      <tr>
        <td bgcolor="#BDBEBD"><strong>文件列表</strong></td>
      </tr>
      <tr>
              <td>
              <table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#EFEFEF">
          <tr >
            <td><b>文件名</b></td>
            <td><b>修改日期</b></td>
            <td><b>文件大小</b></td>
            <td><b>操作</b></td>
          </tr>
      <?php
$fso=@opendir($CurrentPath);
while ($file=@readdir($fso)) {
        $fullpath        = "$CurrentPath/$file";
        $is_dir                = @is_dir($fullpath);
        if($is_dir=="0"){
        $size=@filesize("$CurrentPath/$file");
        $size=@getSize($size);
        $lastsave=@date("Y-n-d H:i:s",filemtime("$CurrentPath/$file"));
    echo "<tr bgcolor=\"#EFEFEF\">\n";
    echo "<td>◇ $file</td>\n";
        echo "  <td>$lastsave</td>\n";
    echo "  <td>$size</td>\n";
        echo "  <td><a href=\"?downfile=".urlencode($CurrentPath)."/".urlencode($file)."\">下载</a> | <a href=\"?path=".urlencode($CurrentPath)."&delfile=".urlencode($CurrentPath)."/".urlencode($file)."\">删除</a></td>\n";
        echo "</tr>\n";
        }
}
@closedir($fso);
?></table>
</td>
</tr>
    </table></td>
  </tr>
  <tr>
  <td bgcolor="#DDDDDD">
  <table width="100%"  border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td bgcolor="#BCBCBC"><strong>CopyRight</strong></td>
      </tr>
      <tr>
      <td>
      <table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#EFEFEF">
      <tr>
      <td>Copyright (C) 2005 <a href = mailto:[email protected]><font color="red"><b>Leslee</b></font></a> All Rights Reserved . </td></tr></table>
      </td>
      </tr>
      </table>
  </td>
  </tr>
</table>
</body>
</html>

解决方案 »

  1.   

    我觉得在这加个判断就可以$CurrentPath当前值是否为user,但不知怎么加,$CurrentPath是什么格式:
    if($file=="..")
                    {
                            echo "<tr bgcolor=\"#EFEFEF\">\n";
                            echo "<td>【上级】 <a href=\"?path=".urlencode($CurrentPath)."/".urlencode($file)."\">上级目录</a></td>";
                            echo "</tr>\n";
                    }