一套用于站点维护的页面程序(特别适用与linux下面)
长沙北大青鸟作者:科泰校区匿名
摘要:把这些文件放置于你的根目录下面的任意一个文件夹内!未加密!请读者自己加密!文件清单:chdir.php;delete.php;found.php;index.php;rename.php;show.php;upload.php;由于upload.php中一些程序未完成,希望网友自己
把这些文件放置于你的根目录下面的任意一个文件夹内!未加密!请读者自己加密!
文件清单:
chdir.php;delete.php;found.php;index.php;rename.php;show.php;upload.php;
由于upload.php中一些程序未完成,希望网友自己来完成;
------index.php----------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<table width="775" border="0" align="center" cellpadding="0" cellspacing="00">
<tr>
<td> <form name="form1" method="post" action="found.php">
<div align="center"> <font size="2">建立文件夹部分:</font> <font size="2">
<input type="text" name="newname">
<input type="submit" name="Submit" value="建立文件夹">
</font></div>
</form></td>
</tr>
<tr>
<td height="117"><div align="center"><font size="2">文件列表部分:
<?
if($path=="")
{$path=".";}
else
{
$path=base64_decode($path);
}
$root=base64_decode(".");
$cope_path=base64_encode($path);
chdir("../");
chdir("$path");
$handle=@opendir(".");
echo "<br><a href=index.php?path=$root>回到根目录</a>";
?>
</font> </div>
<table width="75%" border="1" align="center" cellpadding="0" cellspacing="00" bordercolor="#FFFFFF" bordercolorlight="#000000">
<tr>
<td width="25%"><div align="center"><font size="2" face="Verdana">文档列表</font></div></td>
<td width="75%"><div align="center"><font size="2" face="Verdana">删除 改名 进入</font></div></td>
</tr>
<?
while($file=readdir($handle))
{
if($file!="."&&$file!="..")
{if(is_dir($file))
{
?>
<tr>
<td height="30"><div align="left"><font size="2" face="Verdana"><a href="chdir.php?file=<? echo urlencode($file); ?>&path=<? echo $cope_path; ?>"><? echo $file;?></a></font></div></td>
<td height="30"><div align="center"><font size="2" face="Verdana"><a href="delete.php?file=<? echo urlencode($file); ?>&path=<? echo $cope_path; ?>">删除</a>
<a href="rename.php?file=<? echo urlencode($file) ; ?>&path=<? echo $cope_path; ?>">改名</a>
<a href="chdir.php?file=<? echo urlencode($file); ?>&path=<? echo $cope_path; ?>">
浏览</a></font></div></td>
</tr>
<?
}
else
{
?>
<tr>
<td height="30"><div align="left"><font size="2" face="Verdana"><a href="show.php?file=<? echo urlencode($file); ?>&path=<? echo $cope_path; ?>" target="_blank"><? echo $file;?></a></font></div></td>
<td height="30"><div align="center"><font size="2" face="Verdana"><a href="delete.php?file=<? echo urlencode($file) ; ?>&path=<? echo $cope_path; ?>">删除</a>
<a href="rename.php?file=<? echo urlencode($file); ?>&path=<? echo $cope_path; ?>"> 改名</a>
<a href="show.php?file=<? echo urlencode($file); ?>&path=<? echo $cope_path; ?>" target="_blank"> 浏览</a></font></div></td>
</tr>
<?
}
}
}?>
</table>
<form action="upload.php" method="post" enctype="multipart/form-data" name="form2">
<div align="center"><font size="2">上传文件部分:<br>
</font><font size="2" face="Verdana">
<input type="hidden" name="path" value="<? echo $path; ?>">
<input name="file1" type="file" size="15">
<input name="file2" type="file" size="15">
<br>
<input name="file3" type="file" size="15">
<input name="file4" type="file" size="15">
<br>
<input name="file5" type="file" size="15">
<input name="file6" type="file" size="15">
<br>
<input name="file7" type="file" size="15">
<input name="file8" type="file" size="15">
<br>
<input name="file9" type="file" size="15">
<input name="file10" type="file" size="15">
<br>
<input name="Submit2" type="submit" id="Submit2" value="上传">
<input type="reset" name="Submit3" value="重选">
</font> </div>
</form></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="156"> </td>
</tr>
</table>
</body>
</html>
------------chdir.php--------------------
<?
if($path)
{
$path=base64_decode($path);
$file=urldecode($file);
$path.="/".$file;
$path=base64_encode($path);
echo "<meta http-equiv='refresh' content='0;URL=index.php?path=$path'>";
}
?>
---------------delete.php-----------------------
<?
if($path)
{
$path=base64_decode($path);
$file=urldecode($file);
chdir("../$path");
if(!is_dir($file))
{
unlink($file);
$path=base64_encode($path);
echo "<div align='center'><font color='RED'>成功删除文件!</font></div>";
echo "<meta http-equiv='refresh' content='0;URL=index.php?path=$path'>";
}
else
{
$info=rmdir($file);
if($info=="0")
{
$path=base64_encode($path);
$file=urlencode($file);
echo "<div align='center'><font color='RED'>您的文件夹非空!为了安全,请进入确认是否要删除这些文件!</font></div>";
echo "<meta http-equiv='refresh' content='2;URL=chdir.php?file=$file&path=$path'>";
}
else
{
echo "<div align='center'><font color='RED'>成功删除文件!</font></div>";
echo "<meta http-equiv='refresh' content='0;URL=index.php?path=$path'>";
}
}
}
?>
----------------------found.php---------------------
<?
if($path)
{
if($Submit)
{
if($newname)
{
$path=base64_decode($path);
$file=urldecode($file);
chdir("../$path");
mkdir($newname,777);
$path=base64_encode($path);
echo "<div align='center'><font color='RED'>成功建立文件夹!</font></div>";
echo "<meta http-equiv='refresh' content='0;URL=index.php?path=$path'>";
}
}}
?>
----------------------rename.php-------------------------
<?
if($path)
{
if($Submit)
{
if($newname)
{
$path=base64_decode($path);
$file=urldecode($file);
chdir("../$path");
rename($file,$newname);
$path=base64_encode($path);
echo "<div align='center'><font color='RED'>成功更改文件名!</font></div>";
echo "<meta http-equiv='refresh' content='1;URL=index.php?path=$path'>";
}
}
else
{?>
<form name="form1" method="post" action="<? echo $php_self;?>">
<div align="center">文件<? echo $file;?>改名为 :
<input name="newname" type="text" size="10">
<input type="submit" name="Submit" value="改名">
</div>
</form>
<?
}
}
?>
---------------show.php------------------------
<?
if($path)
{
$path=base64_decode($path);
$file=urldecode($file);
$path.="/".$file;//$path=base64_encode($path);
echo "<meta http-equiv='refresh' content='0;URL=../$path'>";
}
?>
-------------------------upload.php-----------------------
有待解决~~~~~只能上传一个文件!
代码重复,也可以实现!
<?
if($Submit2)
{
$path=base64_decode($path);
chdir("../$path");
// 下面的代码重复也可以实现多文件上传!将$file1顺次改成$file2,3,4...
if($file1="")
{
$newname=$file1_name;
@copy($file1,$newname);
}
//这里结束;
}
$path=base64_encode($path);
echo "您的文件上传成功!";
echo "<meta http-equiv='refresh' content='1;URL=index.php?path=$path'>";
}
?>