找回密码
 注册
【阿里云】2核2G云服务器新老同享 99元/年,续费同价,云服务器3年机/5年机限时抢购,低至 2.5折华为云精选云产品特惠糖果主机Jtti,新加坡服务器,美国服务器,香港服务器,海外云服务器
查看: 821|回复: 8

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

[复制链接]
发表于 2008 年 4 月 8 日 13:34:14 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
php空间顽固文件删除的文件有没有啊?
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
发表于 2008 年 4 月 8 日 13:43:22 | 显示全部楼层
【腾讯云】2核2G云服务器新老同享 99元/年,续费同价
  1. <?
  2. /********************************************************************************/
  3. /* Wanderer Board (附属删除程式):                                                */
  4. /* ==============================                                                */
  5. /* Version: 2.0.0 -- 07 July 2001                                                */
  6. /*                                                                                */
  7. /* ---------------------------------------------------                                */
  8. /* - 程式版權 (c) 2001 by 旅 行 [url]www.lvxing.net[/url]             -                                */
  9. /* - PHPの酷 版權所有   [url]http://phpiscool.yeah.net[/url]    -                                */
  10. /* ---------------------------------------------------                                */
  11. /*                                                                                */
  12. /* ==============================                                                */
  13. /* 網站地址:  phpiscool.yeah.net - [url]www.lvxing.net[/url] - wdb.yesky.net                */
  14. /********************************************************************************/
  15. /* 版權說明: 本軟體为共享軟體。你可以使用, 放置網站供他人下載。请保留此声明        */
  16. /*                                                                                */
  17. /* 本人保留對本軟體之更改與訂正之權利, 任何人不得修改本軟體之任一部份(如必        */
  18. /* 須更改請與作者聯絡)。使用者執行本軟體所需之設定或美化外觀所需之更改不在此        */
  19. /* 限。使用者須保留版權說明和著作權申明,不得刪除。                                */
  20. /*                                                                                */
  21. /* 違反著作權法之規定,本人保留法律追訴之權利,逕對使用者控告侵害著作權!        */
  22. /********************************************************************************/

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

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

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

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

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


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

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

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


  95.    <table width=400 align=center cellspacing=1 cellpadding=0 bgcolor=333333>
  96.     <tr><td>
  97.     <table width=100% cellspacing=0 cellpadding=3>
  98.     <tr bgcolor=EEEEE8><td valign=middle align=center>
  99.     <font face=verdana color=#555555>
  100. <?        
  101.         if (is_dir($dir)) {
  102.                         kill_dir($dir);
  103.                         echo "<b>$dir</b> -- ";
  104.                         if (rmdir($dir)) echo "成功删除";
  105.                         else echo "失败";
  106.                         echo "
  107. ";
  108.         } else {
  109.                         echo "<b>$dir</b> -- ";
  110.                         if (unlink($dir)) echo "成功删除";
  111.                         else echo "失败";
  112.                         echo "
  113. ";
  114.         }
  115. ?>

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

  120. </td></tr>
  121.     <tr>
  122.     <td bgcolor=#FFFFFF valign=middle align=left colspan=2><font color=#555555>
  123.     <blockquote><b>请注意</b><p><b>你可以使用绝对路径/相对路径</b><p>绝对路径请填写完整,UNIX下比如: /home/myaccount/tesdir 在NT下比如: C:/www/testdir 。
  124. 相对路径的填写是相对于本脚本存在位置的: 比如本脚本存在于 wdb 目录下,您欲删除 wdb/userdir, 则可以填写 userdir
  125. <?
  126. }
  127. function kill_dir($dir) {
  128. $dirhandle=opendir($dir);
  129. while($file_name=readdir($dirhandle)) {
  130.         if ($file_name!="." && $file_name!="..") {
  131.                 if (is_dir("$dir/$file_name")) {
  132.                         kill_dir($dir."/".$file_name);
  133.                         echo "<b>$dir/$file_name</b> -- ";
  134.                         if (rmdir("$dir/$file_name")) echo "成功删除";
  135.                         else echo "失败";
  136.                         echo "
  137. ";
  138.                         } else {echo "$dir/$file_name -- ";
  139.                         if (unlink("$dir/$file_name")) echo "成功删除";
  140.                         else echo "失败";
  141.                         echo "
  142. ";
  143.                         }
  144.                 }
  145.         }
  146. closedir($dirhandle);
  147. }
  148. ?>
  149.         <hr>
  150.     <table width=200 align=right cellspacing=0 cellpadding=0 bgcolor=333333>
  151.     <tr><td>
  152.     <table width=100% cellspacing=1 cellpadding=3>
  153.     <tr><td bgcolor=EEEEE8>
  154. 软体编写: <a href="[url]http://lvxing.net[/url]" target=_blank>旅 行</a>

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

  156.   A memeber of Lyra Studio
  157.     </td></tr></table>
  158.     </td></tr></table>    </blockquote>
  159.         
  160.         </td></tr>
  161.     </table></td></tr></table>
  162.     </td></tr></table></body></html>
复制代码

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

评分

参与人数 1兑换券 +4 威望 +4 收起 理由
pengxing + 4 + 4 看你这么累,辛苦分加一个

查看全部评分

Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2008 年 4 月 8 日 13:43:40 | 显示全部楼层
  1. <?php
  2. /*
  3. +----------------------------------------------------------------------+
  4. | PHP Version 4                                                        |
  5. +----------------------------------------------------------------------+
  6. | PRO_Name   :  目录/文件删除管理器                                    |
  7. | Author     :  windnets                                               |
  8. | C_Date     :  2004-1-3                                               |
  9. | M_Date     :  2004-1-4                                               |
  10. | WebSite    :  http://www.chenfeng.net                                |
  11. +----------------------------------------------------------------------+
  12. */

  13. // 删除目录.若$delSelf=0,则保留自身目录;若$delSelf=1,则连同自身目录也删除.
  14. function rm_dir($dir, $delSelf="0") {
  15.     if(@!$opendir = opendir($dir)) {
  16.         return false;
  17.     }
  18.     while(false !== ($readdir = readdir($opendir))) {
  19.         if($readdir !== '..' && $readdir !== '.') {
  20.             $readdir = trim($readdir);
  21.             if(is_file($dir.'/'.$readdir)) {
  22.                 if(@!unlink($dir.'/'.$readdir)) {
  23.                     return false;
  24.                 }
  25.             } elseif(is_dir($dir.'/'.$readdir)) {
  26.                 if(!rm_dir($dir.'/'.$readdir)) {
  27.                     return false;
  28.                 }
  29.                                 if(@!rmdir($dir.'/'.$readdir)) {
  30.                                         return false;
  31.                                 }
  32.             }
  33.         }
  34.     }
  35.     closedir($opendir);
  36.         if($delSelf == 1) {
  37.                 if(@!rmdir($dir)) {
  38.                         return false;
  39.                 }
  40.         }
  41.     return true;
  42. }

  43. // 获取文件列表
  44. function get_dir_list($dir) {
  45.     if(@ ! $opendir = opendir($dir)) {
  46.         return false;
  47.     }
  48.     while(false !== ($readdir = readdir($opendir))) {
  49.                 if($readdir !== '..' && $readdir !== '.') {
  50.             $readdir = trim($readdir);
  51.                         if($readdir == "index.php")
  52.                                 continue;
  53.                         $dir_list[] = $dir.'/'.$readdir;
  54.         }
  55.         }
  56.         closedir($opendir);
  57.         return $dir_list;
  58. }

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

  62.         $dir_list = get_dir_list($dir);
  63.         if(is_array($dir_list))
  64.                 $dir_list = array_reverse($dir_list);
  65.         $total = count($dir_list);

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

  67.         if(is_array($dir_list)) {
  68.                 for($i=($p-1)*10;$i<$p*10;$i++) {
  69.                         if($i > $total-1)
  70.                                 break;
  71.                         $show_file = $dir_list[$i];
  72.                         if(is_dir($show_file)) {
  73.                                 $show_files = '<A HREF="'.$_SERVER[PHP_SELF].'?dir='.$show_file.'">'.$show_file.'</A>';
  74.                         } else {
  75.                                 $show_files = $show_file;
  76.                         }
  77.                         show_dir_tpl($show_file, $show_files);
  78.                 }
  79.         }
  80. }

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

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

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

  101.         return $string;
  102. }

  103. // 页首模板
  104. function header_tpl($upper_dir) {
  105. print <<<E
  106. <HTML>
  107. <HEAD>
  108. <TITLE> 目录/文件删除管理器 </TITLE>
  109. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  110. <style type='text/css'>
  111. body {
  112.     margin: 10px 10px 10px 10px;
  113.     color: #333333;
  114.     font: 9pt Verdana;
  115. }
  116. img              {border: 0;}
  117. hr               {color: #c2c2c5; height: 1px;}
  118. td, p, div, span {color: #333333; font-size: 9pt;}
  119. input, textarea  {color: #333333; font: 9pt Verdana; background: #efefef;}
  120. textarea         {width: 70%;}
  121. </style>
  122. <SCRIPT LANGUAGE="JavaScript">
  123. <!--
  124. function del_file() {
  125.         if(confirm('是否要删除这个文件?')) {
  126.                         with(document.form1) { action.value = 'del_file'; submit(); }
  127.         }
  128. }
  129. function del_whole_dir() {
  130.         if(confirm('是否要完整删除这个目录?')) {
  131.                         with(document.form1) { action.value = 'del_whole_dir'; submit(); }
  132.         }
  133. }
  134. function del_sub_dir() {
  135.         if(confirm('是否要删除这个目录的所有子目录及文件?')) {
  136.                         with(document.form1) { action.value = 'del_sub_dir'; submit(); }
  137.         }
  138. }
  139. //-->
  140. </SCRIPT>
  141. </HEAD>

  142. <BODY>
  143. <CENTER>
  144. <FONT family="Verdana" SIZE="1">目录/文件删除管理器</FONT>
  145. <HR>
  146. <table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#000000">
  147. <TR>
  148.         <TD bgcolor="#ffc8c8" height="3">
  149.         <TABLE width="100%" border="0" cellspacing="0" cellpadding="2">
  150.         <TR>
  151.                 <TD width="5%">删除</TD>
  152.                 <TD>目录/文件列表</TD>
  153.                 <TD><A HREF="$_SERVER[PHP_SELF]?dir=$upper_dir">上级目录</A></TD>
  154.         </TR>
  155.         </TABLE>
  156.         </TD>
  157. </TR>
  158. </TABLE>

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

  167. // 列表模板
  168. function show_dir_tpl($show_file, $show_files) {
  169. print <<<E
  170. <TR>
  171.         <TD width="5%"><INPUT TYPE="radio" NAME="dir_file_name" value="$show_file"></TD>
  172.         <TD>$show_files</TD>
  173. </TR>
  174. E;
  175. }

  176. // 页脚模板
  177. function footer_tpl($show_page) {
  178. print <<<E
  179.         </TABLE>
  180.         </TD>
  181. </TR>
  182. </TABLE>
  183. $show_page

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

  195. // MAIN START

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

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

  204. header_tpl($upper_dir);

  205. if($_POST['action'] == "del_whole_dir") {
  206.         rm_dir($dir_file_name, 1);
  207.         print '<script type="text/javascript">window.location="'.$_SERVER[HTTP_REFERER].'"</script>';
  208. } elseif($_POST['action'] == "del_sub_dir") {
  209.         rm_dir($dir_file_name);
  210.         print '<script type="text/javascript">window.location="'.$_SERVER[HTTP_REFERER].'"</script>';
  211. } elseif($_POST['action'] == "del_file") {
  212.         chmod($dir_file_name, 0777);
  213.         unlink($dir_file_name);
  214.         print '<script type="text/javascript">window.location="'.$_SERVER[HTTP_REFERER].'"</script>';
  215. } else {
  216.         show_dir($dir);
  217. }

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

  222. footer_tpl($show_page);

  223. // MAIN END
  224. ?>
复制代码
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2008 年 4 月 8 日 13:44:00 | 显示全部楼层
  1. <!-- 有时常有目录或文件无法删除 有些头痛吧 -->
  2. <html>
  3. <head>
  4. <title>Ofstar Board目录删除程序
  5. </title>
  6. <style type="text/css">
  7.     BODY { COLOR: #3F3849; FONT-FAMILY: Verdana,Arial; FONT-SIZE: 9pt;
  8.         SCROLLBAR-HIGHLIGHT-COLOR: buttonface;
  9. SCROLLBAR-SHADOW-COLOR: buttonface;
  10. SCROLLBAR-3DLIGHT-COLOR: buttonhighlight;
  11. SCROLLBAR-TRACK-COLOR: #eeeeee;
  12. SCROLLBAR-DARKSHADOW-COLOR: buttonshadow
  13. }
  14. A:LINK                {COLOR: #3F3849; TEXT-DECORATION: none}
  15. A:VISITED        {COLOR: #3F3849; TEXT-DECORATION: none}
  16. A:HOVER                {COLOR: #F5D300; BACKGROUND-COLOR: #40364d}
  17. A:ACTIVE        {COLOR: #F5D300; BACKGROUND-COLOR: #40364d}
  18.                
  19.                 .t     {        LINE-HEIGHT: 1.4}
  20.                 TD,SELECT,TEXTAREA,DIV,FORM,OPTION,P{COLOR:333333; FONT-FAMILY: 宋体; FONT-SIZE: 9pt}
  21.                 INPUT  {        FONT-FAMILY: 宋体; FONT-SIZE: 9pt; height:22px;        }
  22.     </style>
  23. </head>
  24. <body vlink=333333 link=333333 alink=333333 topmargin=0 leftmargin="0" background=#000000>
  25. <center>
  26. <?
  27. function delfile($filename)
  28. {
  29.         $db=opendir("$filename/");
  30.         while ($getfile=readdir($db))
  31.         {
  32.                 if ($getfile!="." && $getfile!="..")
  33.                 {
  34.                         if(is_dir("$filename/$getfile"))
  35.                         {
  36.                                 delfile($filename."/".$getfile);
  37.                                 if (@rmdir($filename."/".$getfile))
  38.                                         echo "删除 $filename/$getfile 目录成功
  39. ";

  40.                         }
  41.                         else
  42.                         {
  43.                                 if(@unlink("$filename/$getfile"))
  44.                                         echo "删除 $filename/$getfile 文件成功
  45. ";
  46.                                 else
  47.                                         echo "删除 $filename/$getfile 文件失败
  48. ";
  49.                         }
  50.                 }
  51.         }
  52.         closedir($db);
  53. }
  54. function chmodfile($filename)
  55. {
  56.         $db=opendir("$filename/");
  57.         while ($getfile=readdir($db))
  58.         {
  59.                 if ($getfile!="." && $getfile!="..")
  60.                 {
  61.                         if(is_dir("$filename/$getfile"))
  62.                         {
  63.                                 chmodfile($filename."/".$getfile);
  64.                                 if (@chmod($filename."/".$getfile,0777))
  65.                                         echo "设置属性 777 $filename/$getfile 目录成功
  66. ";

  67.                         }
  68.                         else
  69.                         {
  70.                                 if(@chmod("$filename/$getfile",0777))
  71.                                         echo "设置属性 777 $filename/$getfile 文件成功
  72. ";
  73.                                 else
  74.                                         echo "设置属性 777 $filename/$getfile 文件失败
  75. ";
  76.                         }
  77.                 }
  78.         }
  79.         closedir($db);
  80. }
  81. $bacename="ofstar.php";
  82.         if($step==2)
  83.         {
  84.                 if(is_dir($del_name))
  85.                 {
  86.                         delfile($del_name);
  87.                         if (@rmdir($del_name))
  88.                                 echo "删除 $del_name 目录成功
  89. ";
  90.                         else
  91.                                 echo "删除 $del_name 目录失败
  92. ";
  93.                 }
  94.                 else
  95.                 {
  96.                         if(@unlink($del_name))
  97.                                 echo "删除 $del_name 文件成功
  98. ";
  99.                         else
  100.                                 echo "删除 $del_name 文件失败
  101. ";
  102.                 }
  103.                 echo "
  104. <a href=ofstar.php>返回继续操作</a>
  105. ";
  106.         }
  107.         elseif($step==1)
  108.         {
  109.                 if(is_dir($chmod_name))
  110.                 {
  111.                         chmodfile($chmod_name);
  112.                         if (@rmdir($chmod_name))
  113.                                 echo "设置属性 777 $chmod_name 目录成功
  114. ";
  115.                         else
  116.                                 echo "设置属性 777 $chmod_name 目录失败
  117. ";
  118.                 }
  119.                 else
  120.                 {
  121.                         if(@unlink($chmod_name))
  122.                                 echo "设置属性 777 $chmod_name 文件成功
  123. ";
  124.                         else
  125.                                 echo "设置属性 777 $chmod_name 文件失败
  126. ";
  127.                 }
  128.                 echo "
  129. <a href=ofstar.php>返回继续操作</a>
  130. ";
  131.         }
  132.         else
  133.         {
  134. ?>
  135. <form name="FORM" method=POST action=ofstar.php  enctype="multipart/form-data">
  136. <tr>
  137.         <td valign=top><font size="3" color="red">此程序的目的是:有些unix主机当你通过ftp软件管理时无法删除文件或将属性设置为777时,你只要输入你所需要操作的目录或文件就能通过PHP程序进行删除与设置属性为777</font>
  138. <font face="verdana, arial">删除目录或文件:</font>

  139.         </td>
  140.         <td colspan=2>
  141.         请输入你要删除的文件名或目录( 名字不要用中文):&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 = ''">
  142.         </font></td>
  143. </tr>
  144. <tr><td><input type=hidden value=2 name=step>
  145. <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()>
  146. </td>
  147. </tr>

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

  152.         </td>
  153.         <td colspan=2>
  154.         请输入你要设置的文件名或目录(不适用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 = ''">
  155.         </font></td>
  156. </tr>
  157. <tr><td><input type=hidden value=1 name=step>
  158. <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()>
  159. </td>
  160. </tr>

  161. </form>
  162. <?
  163.         }?>

  164. <tr>
  165.         <td>Writen by <a href="http://www.ofstar.net">Ofstar Group</a>
  166. </tr>
  167.         </center>
复制代码
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2008 年 4 月 8 日 13:44:21 | 显示全部楼层
  1. <?php
  2. /*
  3. FileName : FileContral.php
  4. Desc : to dir all files on Server. can download files and delete files.
  5. author : Leslee
  6. email : [email]leslee@ipn.cn[/email]
  7. */
  8. error_reporting(0);
  9. /* 上传文件 */
  10. function upfile($file_var,$tofile,$filepath){
  11.        /* 参数说明:
  12.       
  13.        */
  14.        if(!is_writable($filepath)){
  15.               echo"$filepath 目录不存在或不可写";
  16.               return false;
  17.               exit;
  18.        }
  19.        //echo $_FILES["$file_var"]['name'];
  20.        $Filetype=substr(strrchr($_FILES["$file_var"]['name'],"."),1);
  21.        ($tofile==='')?($uploadfile = $_FILES["$file_var"]['name']):($uploadfile = $tofile.".".$Filetype);//文件名
  22.      $Array[tofile] = $tofile.'.'.$Filetype;
  23.         $Array[oldfile]= $_FILES["$file_var"]['name'];
  24.        if(!($uploadfile==='')){
  25.               if (!is_uploaded_file($_FILES["$file_var"]['tmp_name'])){
  26.              echo $_FILES["$file_var"]['tmp_name']." 上传失败.";
  27.                       return false;
  28.              exit;
  29.               }

  30.            if (!move_uploaded_file($_FILES["$file_var"]['tmp_name'],$filepath.'/'.$uploadfile)){
  31.              echo "上传失败。错误信息:\n";
  32.              print_r($_FILES);
  33.              exit;
  34.                       }else{
  35.                       return $Array;
  36.                       }
  37.        }else{
  38.               return false;
  39.        echo"无法上传";
  40.        }
  41. }
  42. /* 获取文件大小 */
  43. function getSize(&$fs)
  44. {
  45.        if($fs<1024)
  46.               return $fs."Byte";
  47.        elseif($fs>=1024&&$fs<1024*1024)
  48.               return @number_format($fs/1024, 3)." KB";
  49.        elseif($fs>=1024*1024 && $fs<1024*1024*1024)
  50.               return @number_format($fs/1024*1024, 3)." M";
  51.        elseif($fs>=1024*1024*1024)
  52.               return @number_format($fs/1024*1024*1024, 3)." G";
  53. }
  54. // 下载文件
  55. if ($_GET['downfile']) {
  56.        $downfile=$_GET['downfile'];
  57.        if (!@is_file($downfile)) {
  58.               echo "<script>alert("你要下的文件不存在")</script>";
  59.        }
  60.        $filename = basename($downfile);
  61.        $filename_info = explode('.', $filename);
  62.        $fileext = $filename_info[count($filename_info)-1];
  63.        header('Content-type: application/x-'.$fileext);
  64.        header('Content-Disposition: attachment; filename='.$filename);
  65.        header('Content-Description: PHP3 Generated Data');
  66.        readfile($downfile);
  67.        exit;
  68. }

  69. // 删除文件
  70. if(@$_GET['delfile']!="") {
  71.        $delfile=$_GET['delfile'];
  72.        if(file_exists($delfile)) {
  73.               @unlink($delfile);
  74.        } else {
  75.               $exists="1";
  76.               echo "<script>alert("文件已不存在")</script>";
  77.        }
  78.        if(!file_exists($delfile)&&$exists!="1") {
  79.               echo"<script>alert("删除成功")</script>";
  80.        } else {
  81.               echo"<script>alert("删除失败")</script>";
  82.        }
  83. }
  84. /* 检测当前目录值 */
  85. $CurrentPath       = $_POST['path']?$_POST['path']:($_GET['path']?$_GET['path']:false);
  86. if($CurrentPath===false)
  87. {
  88.        $CurrentPath       = dirname(__FILE__);
  89. }
  90. $CurrentPath       = realpath(str_replace('\\','/',$CurrentPath));
  91. /* 检查完毕 */
  92. /* 新建 目录 */
  93. if($_POST['dirname'])
  94. {
  95.        $newdir       = $CurrentPath."/".$_POST['dirname'];
  96.        if(is_dir($newdir))
  97.        {
  98.               echo"<script>alert("此目录名已经存在!")</script>";
  99.               exit;
  100.        }else {
  101.               if(mkdir($newdir,0700))
  102.               {
  103.                      echo"<script>alert("创建成功!")</script>";
  104.               }else {
  105.                      echo "<script>alert("创建失败!")</script>";
  106.               }
  107.        }
  108. }
  109. /* 上传文件 */
  110. if($_POST['upload'])
  111. {
  112.        if(!(upfile("upfiles",$_POST['fname'],$CurrentPath)))
  113.        {
  114.               echo"<script>alert("上传失败!")</script>";
  115.        }else {
  116.               echo "<script>alert("上传成功!")</script>";
  117.        }
  118. }
  119. ?>
  120. <!--nobanner--><html>
  121. <head>
  122. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  123. <title>FileContral v1.0 By Leslee</title>
  124. <style type="text/css">
  125. <!--
  126. body {
  127.        font-family: "宋体";
  128.        font-size: 12px;
  129.        margin-left: 0px;
  130.        margin-top: 0px;
  131.        margin-bottom: 0px;
  132. }
  133. table {
  134.        font-family: "宋体";
  135.        font-size: 12px;
  136.        text-decoration: none;
  137. }
  138. .bold_blue {
  139.        color: #003399;
  140.        font-weight: bold;
  141. }
  142. input {
  143.        border-right-width: 0.1mm;
  144.        border-bottom-width: 0.1mm;
  145.        border-top-style: none;
  146.        border-right-style: solid;
  147.        border-bottom-style: solid;
  148.        border-left-style: none;
  149.        border-right-color: #CCCCCC;
  150.        border-bottom-color: #CCCCCC;
  151. }
  152. -->
  153. </style>
  154. </head>

  155. <body>
  156. <table width="770" border="0" align="center" cellpadding="5" cellspacing="0">
  157.   <tr>
  158.     <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>
  159.   </tr>
  160.   <tr>
  161.     <td bgcolor="#DDDDDD"><table width="100%" height="100%" border="0" cellpadding="5" cellspacing="2" bgcolor="#F5F5F5">
  162.       <tr><form name="form2" method="post" action="">
  163.         <td><span class="bold_blue"><strong>新建目录</strong>:</span>          <input name="dirname" type="text" id="dirname">
  164.           <input type="submit" name="Submit" value="建 立"></td></form>
  165.       </tr><form name="form3" method="post" action="" enctype="multipart/form-data">
  166.       <tr>
  167.         <td><span class="bold_blue"><strong>上传文件</strong>:</span>          <input name="upfiles" type="file" id="upfiles">
  168.           </td>
  169.       </tr>
  170.       <tr>
  171.         <td><span class="bold_blue"><strong> 新文件名</strong>:</span>          <input name="fname" type="test" id="fname">
  172.           <input type="submit" name="upload" value="上 传"></td>
  173.       </tr></form>
  174.       <tr>
  175.         <td><span class="bold_blue">当前路径:</span><font color=red><?php echo $CurrentPath;?></font></td>
  176.       </tr>
  177.     </table>
  178.     </td>
  179.   </tr>
  180.   <tr>
  181.     <td bgcolor="#DDDDDD"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
  182.       <tr>
  183.         <td bgcolor="#BCBCBC"><strong>子目录</strong></td>
  184.       </tr>
  185.       <tr>
  186.       <td>
  187.       <table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#EFEFEF">
  188.       <?php
  189. $fso=@opendir($CurrentPath);
  190. while ($file=@readdir($fso)) {
  191.        $fullpath       = "$CurrentPath/$file";
  192.        $is_dir              = @is_dir($fullpath);
  193.        if($is_dir=="1"){
  194.        if($file!=".."&&$file!=".")       {
  195.               echo "<tr bgcolor="#EFEFEF">\n";
  196.               echo "  <td>【目录】 <a href="?path=".urlencode($CurrentPath)."/".urlencode($file)."">$file</a></td>\n";
  197.               echo "</tr>\n";
  198.        } else {
  199.               if($file=="..")
  200.               {
  201.                      echo "<tr bgcolor="#EFEFEF">\n";
  202.                      echo "<td>【上级】 <a href="?path=".urlencode($CurrentPath)."/".urlencode($file)."">上级目录</a></td>";
  203.                      echo "</tr>\n";
  204.               }
  205.        }
  206.        }
  207. }
  208. @closedir($fso);
  209. ?>
  210. </table>
  211. </td>
  212. </tr>
  213.       <tr>
  214.         <td bgcolor="#BDBEBD"><strong>文件列表</strong></td>
  215.       </tr>
  216.       <tr>
  217.              <td>
  218.              <table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#EFEFEF">
  219.           <tr >
  220.             <td><b>文件名</b></td>
  221.             <td><b>修改日期</b></td>
  222.             <td><b>文件大小</b></td>
  223.             <td><b>操作</b></td>
  224.           </tr>
  225.       <?php
  226. $fso=@opendir($CurrentPath);
  227. while ($file=@readdir($fso)) {
  228.        $fullpath       = "$CurrentPath/$file";
  229.        $is_dir              = @is_dir($fullpath);
  230.        if($is_dir=="0"){
  231.        $size=@filesize("$CurrentPath/$file");
  232.        $size=@getSize($size);
  233.        $lastsave=@date("Y-n-d H:i:s",filemtime("$CurrentPath/$file"));
  234.     echo "<tr bgcolor="#EFEFEF">\n";
  235.     echo "<td>◇ $file</td>\n";
  236.        echo "  <td>$lastsave</td>\n";
  237.     echo "  <td>$size</td>\n";
  238.        echo "  <td><a href="?downfile=".urlencode($CurrentPath)."/".urlencode($file)."">下载</a> | <a href="?path=".urlencode($CurrentPath)."&delfile=".urlencode($CurrentPath)."/".urlencode($file)."">删除</a></td>\n";
  239.        echo "</tr>\n";
  240.        }
  241. }
  242. @closedir($fso);
  243. ?></table>
  244. </td>
  245. </tr>
  246.     </table></td>
  247.   </tr>
  248.   <tr>
  249.   <td bgcolor="#DDDDDD">
  250.   <table width="100%"  border="0" cellspacing="0" cellpadding="5">
  251.       <tr>
  252.         <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>
  253.       </table>      
  254.   </td>
  255.   </tr>
  256. </table>
  257. <style></body>
  258. </html>
复制代码
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2008 年 4 月 8 日 13:56:36 | 显示全部楼层
顶楼上的
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2008 年 4 月 8 日 15:23:44 | 显示全部楼层
【腾讯云】2核2G云服务器新老同享 99元/年,续费同价
某淫也不怕累着
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2008 年 4 月 8 日 16:59:24 | 显示全部楼层
是不是DA空间?
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2008 年 4 月 8 日 17:44:31 | 显示全部楼层
小林子今天精神好,肯定用了盖中盖了
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|金光论坛

GMT+8, 2024 年 9 月 20 日 12:31 , Processed in 0.124067 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表