tanguan 发表于 2008 年 4 月 8 日 13:34:14

php空间顽固文件删除的文件有没有啊?

php空间顽固文件删除的文件有没有啊?

疏林阁 发表于 2008 年 4 月 8 日 13:43:22

<?
/********************************************************************************/
/* Wanderer Board (附属删除程式):                                                */
/* ==============================                                                */
/* Version: 2.0.0 -- 07 July 2001                                                */
/*                                                                              */
/* ---------------------------------------------------                              */
/* - 程式版權 (c) 2001 by 旅 行 www.lvxing.net             -                              */
/* - PHPの酷 版權所有   http://phpiscool.yeah.net    -                              */
/* ---------------------------------------------------                              */
/*                                                                              */
/* ==============================                                                */
/* 網站地址:phpiscool.yeah.net - www.lvxing.net - wdb.yesky.net                */
/********************************************************************************/
/* 版權說明: 本軟體为共享軟體。你可以使用, 放置網站供他人下載。请保留此声明      */
/*                                                                              */
/* 本人保留對本軟體之更改與訂正之權利, 任何人不得修改本軟體之任一部份(如必      */
/* 須更改請與作者聯絡)。使用者執行本軟體所需之設定或美化外觀所需之更改不在此      */
/* 限。使用者須保留版權說明和著作權申明,不得刪除。                              */
/*                                                                              */
/* 違反著作權法之規定,本人保留法律追訴之權利,逕對使用者控告侵害著作權!      */
/********************************************************************************/

//-------使用方法--------------------
// 将本软体上传至支持PHP之服务器空间
// 在IE / NS 地址项目输入软体地址
//----------------------------------

//-----对于使用本软体所带来的任何可能损失,本人概不负责---------------

//-----如果由于SAFE MODE导致UID不匹配而无法删除--------------------
// 可以另外创建一PHP程序,比如名为 copy.php, 内容如下,
// 只有一行: <? copy("del1.php", "del.php");
// 将本脚本改名为 del1.php 上传至空间,然后运行 copy.php (两者须在同一目录)
// 然后调用 del.php 即可。

?>
      <html>
    <head>
    <title>WandererBoard - 目录删除工具</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style type="text/css">
    BODY { COLOR: #3F3849; FONT-FAMILY: Verdana,Arial; FONT-SIZE: 9pt;
      SCROLLBAR-BASE-COLOR:#666688;
      SCROLLBAR-ARROW-COLOR: #D3D3FF;
      SCROLLBAR-HIGHLIGHT-COLOR: #444466;
}
A:LINK                {COLOR: #3F3849; TEXT-DECORATION: none}
A:VISITED      {COLOR: #3F3849; TEXT-DECORATION: none}
/* hover color for links (Internet Explorer only) */
A:HOVER                {COLOR: #F5D300; BACKGROUND-COLOR: #40364d}
A:ACTIVE      {COLOR: #F5D300; BACKGROUND-COLOR: #40364d}
               
                .t   {      LINE-HEIGHT: 1.4}
                TD,SELECT,TEXTAREA,DIV,FORM,OPTION,P{COLOR:333333; FONT-FAMILY: 宋体; FONT-SIZE: 9pt}
                INPUT{      FONT-FAMILY: 宋体; FONT-SIZE: 9pt; height:22px;      }
    </style>
    </head>
    <body bgcolor=#555570 topmargin=5 leftmargin=5>
    <table width=95% cellpadding=0 cellspacing=1 border=0 bgcolor=#222244 align=center>
    <tr><td>
    <table width=100% cellpadding=0 cellspacing=1 border=0>
    <tr>

    <td valign=top bgcolor=#FFFFFF>
    <table width=100% cellpadding=6 cellspacing=0 border=0>    <tr><td bgcolor=#80809b colspan=2><font color=#FFFFFF>
    <b>欢迎来到 WDB 讨论区附属工具 -- 文件/目录删除工具</b>
    </td></tr>
<?
if (empty($dir)) {
?>
   <tr>
    <td bgcolor=#EEEEEE valign=middle colspan=2 align=center><font color=#333333><b>请输入您要删除的文件/目录</b></font></td></tr>
    <form action="del.php" method="post">
    <tr><td>


   <table width=300 align=center cellspacing=1 cellpadding=0 bgcolor=333333>
    <tr><td>
    <table width=100% cellspacing=0 cellpadding=3>
    <tr bgcolor=EEEEE8>
    <font face=verdana>
    <td valign=middle align=center><font color=#555555><b>请输入欲删除的文件/目录</b></font>
<input type=text size=45 name="dir" >

警告:该文件/目录删除后无法恢复!!!</td></tr>
</table>
    </td></tr></table>

</td></tr>
    <tr bgcolor=FFFFFF>
    <td valign=middle colspan=2 align=center><input type=submit name="submit" value="确 认"></td></tr></form>
    <tr>
    <td bgcolor=#FFFFFF valign=middle align=left colspan=2><font color=#555555>
    <blockquote><b>请注意</b><p><b>你可以使用绝对路径/相对路径</b><p>绝对路径请填写完整,UNIX下比如: /home/myaccount/tesdir 在NT下比如: C:/www/testdir 。
相对路径的填写是相对于本脚本存在位置的: 比如本脚本存在于 wdb 目录下,您欲删除 wdb/userdir, 则可以填写 userdir
<?
} else {
?>
   <tr>
    <td bgcolor=#EEEEEE valign=middle colspan=2 align=center><font color=#333333><b>执行删除操作</b></font></td></tr>
    <form action="admin.php" method="post">
    <tr><td>


   <table width=400 align=center cellspacing=1 cellpadding=0 bgcolor=333333>
    <tr><td>
    <table width=100% cellspacing=0 cellpadding=3>
    <tr bgcolor=EEEEE8><td valign=middle align=center>
    <font face=verdana color=#555555>
<?      
      if (is_dir($dir)) {
                        kill_dir($dir);
                        echo "<b>$dir</b> -- ";
                        if (rmdir($dir)) echo "成功删除";
                        else echo "失败";
                        echo "
";
      } else {
                        echo "<b>$dir</b> -- ";
                        if (unlink($dir)) echo "成功删除";
                        else echo "失败";
                        echo "
";
      }
?>

    <b>执行完成 ---- 删除操作</b>
提醒:目录无法恢复!!!如果由于权限错误,或其他限制,目录可能无法彻底删除</td></tr>
</table>
    </td></tr></table>

</td></tr>
    <tr>
    <td bgcolor=#FFFFFF valign=middle align=left colspan=2><font color=#555555>
    <blockquote><b>请注意</b><p><b>你可以使用绝对路径/相对路径</b><p>绝对路径请填写完整,UNIX下比如: /home/myaccount/tesdir 在NT下比如: C:/www/testdir 。
相对路径的填写是相对于本脚本存在位置的: 比如本脚本存在于 wdb 目录下,您欲删除 wdb/userdir, 则可以填写 userdir
<?
}
function kill_dir($dir) {
$dirhandle=opendir($dir);
while($file_name=readdir($dirhandle)) {
      if ($file_name!="." && $file_name!="..") {
                if (is_dir("$dir/$file_name")) {
                        kill_dir($dir."/".$file_name);
                        echo "<b>$dir/$file_name</b> -- ";
                        if (rmdir("$dir/$file_name")) echo "成功删除";
                        else echo "失败";
                        echo "
";
                        } else {echo "$dir/$file_name -- ";
                        if (unlink("$dir/$file_name")) echo "成功删除";
                        else echo "失败";
                        echo "
";
                        }
                }
      }
closedir($dirhandle);
}
?>
      <hr>
    <table width=200 align=right cellspacing=0 cellpadding=0 bgcolor=333333>
    <tr><td>
    <table width=100% cellspacing=1 cellpadding=3>
    <tr><td bgcolor=EEEEE8>
软体编写: <a href="http://lvxing.net" target=_blank>旅 行</a>

版权所有: <a href="http://lvxing.net" target=_blank>PHPの酷程式</a>

A memeber of Lyra Studio
    </td></tr></table>
    </td></tr></table>    </blockquote>
      
      </td></tr>
    </table></td></tr></table>
    </td></tr></table></body></html>

[ 本帖最后由 疏林阁 于 2008-4-8 13:45 编辑 ]

疏林阁 发表于 2008 年 4 月 8 日 13:43:40

<?php
/*
+----------------------------------------------------------------------+
| PHP Version 4                                                      |
+----------------------------------------------------------------------+
| PRO_Name   :目录/文件删除管理器                                    |
| Author   :windnets                                             |
| C_Date   :2004-1-3                                             |
| M_Date   :2004-1-4                                             |
| WebSite    :http://www.chenfeng.net                              |
+----------------------------------------------------------------------+
*/

// 删除目录.若$delSelf=0,则保留自身目录;若$delSelf=1,则连同自身目录也删除.
function rm_dir($dir, $delSelf="0") {
    if(@!$opendir = opendir($dir)) {
      return false;
    }
    while(false !== ($readdir = readdir($opendir))) {
      if($readdir !== '..' && $readdir !== '.') {
            $readdir = trim($readdir);
            if(is_file($dir.'/'.$readdir)) {
                if(@!unlink($dir.'/'.$readdir)) {
                  return false;
                }
            } elseif(is_dir($dir.'/'.$readdir)) {
                if(!rm_dir($dir.'/'.$readdir)) {
                  return false;
                }
                                if(@!rmdir($dir.'/'.$readdir)) {
                                        return false;
                                }
            }
      }
    }
    closedir($opendir);
        if($delSelf == 1) {
                if(@!rmdir($dir)) {
                        return false;
                }
        }
    return true;
}

// 获取文件列表
function get_dir_list($dir) {
    if(@ ! $opendir = opendir($dir)) {
      return false;
    }
    while(false !== ($readdir = readdir($opendir))) {
                if($readdir !== '..' && $readdir !== '.') {
            $readdir = trim($readdir);
                        if($readdir == "index.php")
                                continue;
                        $dir_list[] = $dir.'/'.$readdir;
      }
        }
        closedir($opendir);
        return $dir_list;
}

// 显示文件列表
function show_dir($dir) {
        global $total;

        $dir_list = get_dir_list($dir);
        if(is_array($dir_list))
                $dir_list = array_reverse($dir_list);
        $total = count($dir_list);

        $p = $_GET['p'] ? $_GET['p'] : 1;

        if(is_array($dir_list)) {
                for($i=($p-1)*10;$i<$p*10;$i++) {
                        if($i > $total-1)
                                break;
                        $show_file = $dir_list[$i];
                        if(is_dir($show_file)) {
                                $show_files = '<A HREF="'.$_SERVER.'?dir='.$show_file.'">'.$show_file.'</A>';
                        } else {
                                $show_files = $show_file;
                        }
                        show_dir_tpl($show_file, $show_files);
                }
        }
}

// 分页函数 from punbb.
function paging($num_pages, $p, $base_url) {
        if ($num_pages <= 1)
                $string = '<u>1</u>';
        else
        {
                if ($p > 4)
                        $string = '<a href="'.$base_url.'&amp;p=1"><<</a>&nbsp; ;-';

                for ($current=$p-3, $stop=$p+4; $current < $stop; $current++)
                {
                        if ($current < 1 || $current > $num_pages)
                                continue;
                        else if ($current != $p)
                                $string .= '&nbsp; ;<a href="'.$base_url.'&amp;p='.$current.'">'.$current.'</a>';
                        else
                                $string .= '&nbsp; ;<b>'.$current.'</b>';
                }

                if ($p < ($num_pages-3))
                        $string .= '&nbsp; ;-&nbsp; ;<a href="'.$base_url.'&amp;p='.$num_pages.'">>></a>';
        }

        return $string;
}

// 页首模板
function header_tpl($upper_dir) {
print <<<E
<HTML>
<HEAD>
<TITLE> 目录/文件删除管理器 </TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type='text/css'>
body {
    margin: 10px 10px 10px 10px;
    color: #333333;
    font: 9pt Verdana;
}
img            {border: 0;}
hr               {color: #c2c2c5; height: 1px;}
td, p, div, span {color: #333333; font-size: 9pt;}
input, textarea{color: #333333; font: 9pt Verdana; background: #efefef;}
textarea         {width: 70%;}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
function del_file() {
        if(confirm('是否要删除这个文件?')) {
                        with(document.form1) { action.value = 'del_file'; submit(); }
        }
}
function del_whole_dir() {
        if(confirm('是否要完整删除这个目录?')) {
                        with(document.form1) { action.value = 'del_whole_dir'; submit(); }
        }
}
function del_sub_dir() {
        if(confirm('是否要删除这个目录的所有子目录及文件?')) {
                        with(document.form1) { action.value = 'del_sub_dir'; submit(); }
        }
}
//-->
</SCRIPT>
</HEAD>

<BODY>
<CENTER>
<FONT family="Verdana" SIZE="1">目录/文件删除管理器</FONT>
<HR>
<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#000000">
<TR>
        <TD bgcolor="#ffc8c8" height="3">
        <TABLE width="100%" border="0" cellspacing="0" cellpadding="2">
        <TR>
                <TD width="5%">删除</TD>
                <TD>目录/文件列表</TD>
                <TD><A HREF="$_SERVER?dir=$upper_dir">上级目录</A></TD>
        </TR>
        </TABLE>
        </TD>
</TR>
</TABLE>

<TABLE width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#000000">
<form name=form1 action=index.php method=post>
<input type=hidden name=action value=del_file>
<TR>
        <TD bgcolor="#ffc8c8" height="3">
        <TABLE width="100%" border="0" cellspacing="0" cellpadding="2">
E;
}

// 列表模板
function show_dir_tpl($show_file, $show_files) {
print <<<E
<TR>
        <TD width="5%"><INPUT TYPE="radio" NAME="dir_file_name" value="$show_file"></TD>
        <TD>$show_files</TD>
</TR>
E;
}

// 页脚模板
function footer_tpl($show_page) {
print <<<E
        </TABLE>
        </TD>
</TR>
</TABLE>
$show_page

<a href="javascript:del_whole_dir()">删除完整目录</a>&nbsp; ;&nbsp; ;
<a href="javascript:del_sub_dir()">只删除此目录下的子目录及所有文件</a>&nbsp; ;&nbsp; ;
<a href="javascript:del_file()">删除单个文件</a>
<HR>
</form>
Written by windnets 2004-1-4
</CENTER>
</BODY>
</HTML>
E;
}

// MAIN START

$dir = $_GET['dir'] ? $_GET['dir'] : '.';
$dir_file_name = $_POST['dir_file_name'];

$dir_array = explode("/", $dir);
$dir_level = count($dir_array);
$upper_dir = '.';
for($i=1; $i<$dir_level-1;$i++) {
        $upper_dir .= '/'.$dir_array[$i];
}

header_tpl($upper_dir);

if($_POST['action'] == "del_whole_dir") {
        rm_dir($dir_file_name, 1);
        print '<script type="text/javascript">window.location="'.$_SERVER.'"</script>';
} elseif($_POST['action'] == "del_sub_dir") {
        rm_dir($dir_file_name);
        print '<script type="text/javascript">window.location="'.$_SERVER.'"</script>';
} elseif($_POST['action'] == "del_file") {
        chmod($dir_file_name, 0777);
        unlink($dir_file_name);
        print '<script type="text/javascript">window.location="'.$_SERVER.'"</script>';
} else {
        show_dir($dir);
}

$pages = ceil($total / 10);
$p = $_GET['p'] ? $_GET['p'] : 1;
$url    = "index.php?dir=".$_GET['dir'];
$show_page = paging($pages, $p, $url);

footer_tpl($show_page);

// MAIN END
?>

疏林阁 发表于 2008 年 4 月 8 日 13:44:00

<!-- 有时常有目录或文件无法删除 有些头痛吧 -->
<html>
<head>
<title>Ofstar Board目录删除程序
</title>
<style type="text/css">
    BODY { COLOR: #3F3849; FONT-FAMILY: Verdana,Arial; FONT-SIZE: 9pt;
        SCROLLBAR-HIGHLIGHT-COLOR: buttonface;
SCROLLBAR-SHADOW-COLOR: buttonface;
SCROLLBAR-3DLIGHT-COLOR: buttonhighlight;
SCROLLBAR-TRACK-COLOR: #eeeeee;
SCROLLBAR-DARKSHADOW-COLOR: buttonshadow
}
A:LINK                {COLOR: #3F3849; TEXT-DECORATION: none}
A:VISITED        {COLOR: #3F3849; TEXT-DECORATION: none}
A:HOVER                {COLOR: #F5D300; BACKGROUND-COLOR: #40364d}
A:ACTIVE        {COLOR: #F5D300; BACKGROUND-COLOR: #40364d}
               
                .t   {        LINE-HEIGHT: 1.4}
                TD,SELECT,TEXTAREA,DIV,FORM,OPTION,P{COLOR:333333; FONT-FAMILY: 宋体; FONT-SIZE: 9pt}
                INPUT{        FONT-FAMILY: 宋体; FONT-SIZE: 9pt; height:22px;        }
    </style>
</head>
<body vlink=333333 link=333333 alink=333333 topmargin=0 leftmargin="0" background=#000000>
<center>
<?
function delfile($filename)
{
        $db=opendir("$filename/");
        while ($getfile=readdir($db))
        {
                if ($getfile!="." && $getfile!="..")
                {
                        if(is_dir("$filename/$getfile"))
                        {
                                delfile($filename."/".$getfile);
                                if (@rmdir($filename."/".$getfile))
                                        echo "删除 $filename/$getfile 目录成功
";

                        }
                        else
                        {
                                if(@unlink("$filename/$getfile"))
                                        echo "删除 $filename/$getfile 文件成功
";
                                else
                                        echo "删除 $filename/$getfile 文件失败
";
                        }
                }
        }
        closedir($db);
}
function chmodfile($filename)
{
        $db=opendir("$filename/");
        while ($getfile=readdir($db))
        {
                if ($getfile!="." && $getfile!="..")
                {
                        if(is_dir("$filename/$getfile"))
                        {
                                chmodfile($filename."/".$getfile);
                                if (@chmod($filename."/".$getfile,0777))
                                        echo "设置属性 777 $filename/$getfile 目录成功
";

                        }
                        else
                        {
                                if(@chmod("$filename/$getfile",0777))
                                        echo "设置属性 777 $filename/$getfile 文件成功
";
                                else
                                        echo "设置属性 777 $filename/$getfile 文件失败
";
                        }
                }
        }
        closedir($db);
}
$bacename="ofstar.php";
        if($step==2)
        {
                if(is_dir($del_name))
                {
                        delfile($del_name);
                        if (@rmdir($del_name))
                                echo "删除 $del_name 目录成功
";
                        else
                                echo "删除 $del_name 目录失败
";
                }
                else
                {
                        if(@unlink($del_name))
                                echo "删除 $del_name 文件成功
";
                        else
                                echo "删除 $del_name 文件失败
";
                }
                echo "
<a href=ofstar.php>返回继续操作</a>
";
        }
        elseif($step==1)
        {
                if(is_dir($chmod_name))
                {
                        chmodfile($chmod_name);
                        if (@rmdir($chmod_name))
                                echo "设置属性 777 $chmod_name 目录成功
";
                        else
                                echo "设置属性 777 $chmod_name 目录失败
";
                }
                else
                {
                        if(@unlink($chmod_name))
                                echo "设置属性 777 $chmod_name 文件成功
";
                        else
                                echo "设置属性 777 $chmod_name 文件失败
";
                }
                echo "
<a href=ofstar.php>返回继续操作</a>
";
        }
        else
        {
?>
<form name="FORM" method=POST action=ofstar.phpenctype="multipart/form-data">
<tr>
        <td valign=top><font size="3" color="red">此程序的目的是:有些unix主机当你通过ftp软件管理时无法删除文件或将属性设置为777时,你只要输入你所需要操作的目录或文件就能通过PHP程序进行删除与设置属性为777</font>
<font face="verdana, arial">删除目录或文件:</font>

        </td>
        <td colspan=2>
        请输入你要删除的文件名或目录( 名字不要用中文):&nbsp; ;&nbsp; ;<input maxlength=30 size=20 name=del_name style="background-color:#FEFEFF; border: 1 double #B4B4B4" onMouseOver="this.style.backgroundColor = '#E5F0FF'" onMouseOut="this.style.backgroundColor = ''">
        </font></td>
</tr>
<tr><td><input type=hidden value=2 name=step>
<input type=submit value="确认删除" style="height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'" onFocus=this.blur()>
</td>
</tr>

</form>
<form name="FORM1" method=POST action=ofstar.phpenctype="multipart/form-data">
<tr>
        <td valign=top><font face="verdana, arial">设置目录或文件为777属性:</font>

        </td>
        <td colspan=2>
        请输入你要设置的文件名或目录(不适用windows主机):&nbsp; ;&nbsp; ;<input maxlength=30 size=20 name=chmod_name style="background-color:#FEFEFF; border: 1 double #B4B4B4" onMouseOver="this.style.backgroundColor = '#E5F0FF'" onMouseOut="this.style.backgroundColor = ''">
        </font></td>
</tr>
<tr><td><input type=hidden value=1 name=step>
<input type=submit value="确认设置" style="height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'" onFocus=this.blur()>
</td>
</tr>

</form>
<?
        }?>

<tr>
        <td>Writen by <a href="http://www.ofstar.net">Ofstar Group</a>
</tr>
        </center>

疏林阁 发表于 2008 年 4 月 8 日 13:44:21

<?php
/*
FileName : FileContral.php
Desc : to dir all files on Server. can download files and delete files.
author : Leslee
email : leslee@ipn.cn
*/
error_reporting(0);
/* 上传文件 */
function upfile($file_var,$tofile,$filepath){
       /* 参数说明:
      
       */
       if(!is_writable($filepath)){
            echo"$filepath 目录不存在或不可写";
            return false;
            exit;
       }
       //echo $_FILES["$file_var"]['name'];
       $Filetype=substr(strrchr($_FILES["$file_var"]['name'],"."),1);
       ($tofile==='')?($uploadfile = $_FILES["$file_var"]['name']):($uploadfile = $tofile.".".$Filetype);//文件名
   $Array = $tofile.'.'.$Filetype;
      $Array= $_FILES["$file_var"]['name'];
       if(!($uploadfile==='')){
            if (!is_uploaded_file($_FILES["$file_var"]['tmp_name'])){
             echo $_FILES["$file_var"]['tmp_name']." 上传失败.";
                      return false;
             exit;
            }

         if (!move_uploaded_file($_FILES["$file_var"]['tmp_name'],$filepath.'/'.$uploadfile)){
             echo "上传失败。错误信息:\n";
             print_r($_FILES);
             exit;
                      }else{
                      return $Array;
                      }
       }else{
            return false;
       echo"无法上传";
       }
}
/* 获取文件大小 */
function getSize(&$fs)
{
       if($fs<1024)
            return $fs."Byte";
       elseif($fs>=1024&&$fs<1024*1024)
            return @number_format($fs/1024, 3)." KB";
       elseif($fs>=1024*1024 && $fs<1024*1024*1024)
            return @number_format($fs/1024*1024, 3)." M";
       elseif($fs>=1024*1024*1024)
            return @number_format($fs/1024*1024*1024, 3)." G";
}
// 下载文件
if ($_GET['downfile']) {
       $downfile=$_GET['downfile'];
       if (!@is_file($downfile)) {
            echo "<script>alert(\"你要下的文件不存在\")</script>";
       }
       $filename = basename($downfile);
       $filename_info = explode('.', $filename);
       $fileext = $filename_info;
       header('Content-type: application/x-'.$fileext);
       header('Content-Disposition: attachment; filename='.$filename);
       header('Content-Description: PHP3 Generated Data');
       readfile($downfile);
       exit;
}

// 删除文件
if(@$_GET['delfile']!="") {
       $delfile=$_GET['delfile'];
       if(file_exists($delfile)) {
            @unlink($delfile);
       } else {
            $exists="1";
            echo "<script>alert(\"文件已不存在\")</script>";
       }
       if(!file_exists($delfile)&&$exists!="1") {
            echo"<script>alert(\"删除成功\")</script>";
       } else {
            echo"<script>alert(\"删除失败\")</script>";
       }
}
/* 检测当前目录值 */
$CurrentPath       = $_POST['path']?$_POST['path']:($_GET['path']?$_GET['path']:false);
if($CurrentPath===false)
{
       $CurrentPath       = dirname(__FILE__);
}
$CurrentPath       = realpath(str_replace('\\','/',$CurrentPath));
/* 检查完毕 */
/* 新建 目录 */
if($_POST['dirname'])
{
       $newdir       = $CurrentPath."/".$_POST['dirname'];
       if(is_dir($newdir))
       {
            echo"<script>alert(\"此目录名已经存在!\")</script>";
            exit;
       }else {
            if(mkdir($newdir,0700))
            {
                     echo"<script>alert(\"创建成功!\")</script>";
            }else {
                     echo "<script>alert(\"创建失败!\")</script>";
            }
       }
}
/* 上传文件 */
if($_POST['upload'])
{
       if(!(upfile("upfiles",$_POST['fname'],$CurrentPath)))
       {
            echo"<script>alert(\"上传失败!\")</script>";
       }else {
            echo "<script>alert(\"上传成功!\")</script>";
       }
}
?>
<!--nobanner--><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>FileContral v1.0 By Leslee</title>
<style type="text/css">
<!--
body {
       font-family: "宋体";
       font-size: 12px;
       margin-left: 0px;
       margin-top: 0px;
       margin-bottom: 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="center" bgcolor="#BCBCBC"><font color="White">PHP版本:</font><font color=red><?php echo PHP_VERSION;?></font>    <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="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 align="center" bgcolor="#BCBCBC">Copyright (C) 2005 <a href = mailto:leslee@ipn.cn><font color="red"><b>Leslee</b></font></a> All Rights Reserved . </td>
      </table>      
</td>
</tr>
</table>
<style></body>
</html>

wxinlin 发表于 2008 年 4 月 8 日 13:56:36

顶楼上的

pengxing 发表于 2008 年 4 月 8 日 15:23:44

某淫也不怕累着;P

jpfree 发表于 2008 年 4 月 8 日 16:59:24

是不是DA空间?

很明显 发表于 2008 年 4 月 8 日 17:44:31

小林子今天精神好,肯定用了盖中盖了
页: [1]
查看完整版本: php空间顽固文件删除的文件有没有啊?