  
- UID
- 2031431
- 威望
- 27 点
- 金钱
- 2 金币
- 点卡
- 10 点
|
1#
发表于 2005-11-6 00:15
| 只看该作者
删除文件或文件夹的程序
- <style>
- input,body{font-family:verdana; font-size:12px; background-color:#fcfcfc}
- </style>
- <?php
- function CleanDir($dir)
- {
- $handle=opendir($dir);
- while ( $file=readdir($handle) )
- {
- if ( ($file==".") || ($file=="..") ) continue;
- if ( is_dir("$dir/$file") )
- {
- CleanDir("$dir/$file");
- if ( rmdir("$dir/$file") ) echo "Remove dir "$dir/$file" successfully!<p>";
- else echo "<FONT COLOR=RED>Fail to Remove dir "$dir/$file"!</FONT><P>";
- }
- else
- {
- if ( unlink("$dir/$file") ) echo "Del file "$dir/$file" successfully!<p>";
- else echo "<FONT COLOR=RED>Fail to del file "$dir/$file"!</FONT><P>";
- }
- }
- closedir($handle);
- }
- if ( !IsSet($dirname) )
- {
- echo "<form action=$PHP_SELF method=post name=delform><center><font color=red>Folder or File</font> to be deled: <input name=dirname style="color:red"> password: <input type=password name=pass size=6> <input type=submit></center></form>";
- echo " <SCRIPT> document.delform.dirname.focus() </SCRIPT> ";
- }
- else
- {
- if ($pass!="hg") die("wrong password");
- if ( is_file( $dirname ) )
- {
- if ( unlink($dirname) ) echo "Del file "$dirname" successfully!<p>";
- else echo "<FONT COLOR=RED>Fail to del file "$dirname"!</FONT><P>";
- }
- else
- {
- CleanDir($dirname);
- if ( rmdir($dirname) ) echo "Remove dir "$dirname" successfully!<p>";
- else echo "<FONT COLOR=RED>Fail to Remove dir "$dirname"!</FONT><P>";
- }
- }
- ?>
复制代码 |
哈哈哈!!!!你的IP是不是 ?我都知道了!!! |
|