快速删除"文件/目录"工具
作者:蛛蛛虎 日期:2009-10-09
网上找了一段PHP代码,删起来方便多了。
对于asp空间用ASP的木马就OK了。
PS:对于国外的免费空间有CP的可以用其管理文件、文件夹。
复制内容到剪贴板
程序代码
程序代码<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// -----对于使用本软体所带来的任何可能损失,本人概不负责---------------
// -----如果由于SAFE MODE导致UID不匹配而无法删除--------------------
// 可以另外创建一PHP程序,比如名为 copy.php, 内容如下,
// 只有一行: <?php copy("del1.php", "del.php");
// 将本脚本改名为 del1.php 上传至空间,然后运行 copy.php (两者须在同一目录)
// 然后调用 del.php 即可。
$password = "12345"; // 密码
// ========= 以下部分没有特别需要请勿修改 ===========================
$current_path = pathinfo($_SERVER['SCRIPT_FILENAME'] ? $_SERVER['SCRIPT_FILENAME'] : __FILE__);
$current_name = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : "del.php";
@ob_start("ob_gzhandler");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN">
<head>
<title>SpiGer - 目录删除工具</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
body { color: #F9FCFE; font-family: verdana,arial; font-size: 9pt;margin-top:0;margin-left:0;
}
.bmf_table_border{
width: 97%;
background: #F8FCFF;
}
.bmf_table_class{
width: 97%;
background-color: #F8FCFF;
border-left:#448ABD 1px solid;
border-right:#448ABD 1px solid;
}
.bmf_n_table_class{
width: 100%;
background-color: #F8FCFF;
border-left:#448ABD 1px solid;
border-right:#448ABD 1px solid;
border-top:#448ABD 1px solid;
}
td {
border-bottom:1px solid #448ABD;
}
a:link {color: #333333; text-decoration: none;}
a:visited {color: #333333; text-decoration: none;}
a:hover {color: #254394;text-decoration: underline;}
a:active {color: #254394;text-decoration: underline;}
.t { line-height: 1.4;}
td,select,textarea,div,form,option,p{
color:#333333; font-family: tahoma; font-size: 9pt;
}
input { font-family: tahoma; font-size: 9pt; height:22px; }
</style>
</head>
<body>
<table width="95%" cellpadding="0" cellspacing="1" border="0" bgcolor="#14568A" 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="#14568A" colspan="2">
<strong style="color:#FFFFFF;">欢迎使用 文件/目录 删除工具</strong>
</td></tr>
<?php
if (empty($_POST['dir'])) {
?>
<tr>
<td bgcolor="#F9FAFE" valign="middle" colspan="2" align="center"><strong style="color:#428EFF;">请输入您要删除的文件/目录</strong></td></tr>
<tr><td>
<form action="<?php echo $current_name;?>" method="post" style="margin: 0px;">
<table width="85%" align="center" cellspacing="1" cellpadding="0" bgcolor="#448ABD">
<tr><td>
<table width="100%" cellspacing="0" cellpadding="3">
<tr bgcolor="#F8FCFF">
<span style="font-family:verdana;">
<td valign="middle" style="text-align:center;"><strong style="color:#555555;">请输入欲删除的文件/目录</strong>
路径:<input type="text" size="45" name="dir" />
密码:<input type="password" size="45" name="pwd" value="12345" title="密码默认为 12345" />
<input type="checkbox" checked="checked" value="1" name="notips" id="check1" /><label for="check1">不逐个提示成功删除信息</label>
警告:该文件/目录删除后无法恢复!</td></tr>
</table>
</td></tr></table>
</td></tr>
<tr bgcolor="#6DA6D1">
<td valign="middle" colspan="2" align="center"><input type="submit" name="submit" value="确 认" /></td></tr>
<tr>
<td bgcolor="#FFFFFF" valign="middle" align=left colspan=2><font color=#555555>
<strong></form>
请注意</strong><p><strong>你可以使用绝对路径/相对路径</strong><p>绝对路径请填写完整,UNIX下比如: /home/myaccount/tesdir 在NT下比如: C:/www/testdir 。
相对路径的填写是相对于本脚本存在位置的: 比如本脚本存在于 bmb 目录下,您欲删除 bmb/userdir, 则可以填写 userdir
<strong style='color:red;'>友情提示 - 本程序所位于的绝对路径是: <?php echo $current_path['dirname'];
?></strong>
<?php
} else {
?>
<tr>
<td bgcolor="#F9FAFE" valign="middle" colspan="2" align="center"><strong style="color:#428EFF;">执行删除操作</strong></td></tr>
<form action="<?php echo $current_name;?>" method="post" style="margin: 0px;">
<tr><td>
<table width="85%" align="center" cellspacing="1" cellpadding="0" bgcolor="#448ABD">
<tr><td>
<table width="100%" cellspacing="0" cellpadding="3">
<tr bgcolor="#F8FCFF">
<span style="font-family:verdana;">
<?php
if ($_POST['pwd'] == $password) {
$dir = $_POST['dir'];
if (is_dir($dir)) {
kill_dir($dir);
echo "<strong>$dir</strong> -- ";
if (rmdir($dir)) echo "成功删除目录";
else echo "删除目录失败";
echo "
";
} else {
echo "<strong>$dir</strong> -- ";
if (unlink($dir)) echo "成功删除文件";
else echo "删除文件失败";
echo "
";
}
?>
<strong>执行完成 ---- 删除操作</strong>
提醒:目录无法恢复!!!如果由于权限错误,或其他限制,目录可能无法彻底删除
<a href='<?php echo $current_name;?>'>点击此处返回前页</a>
<?php
} else {
echo "<center><strong style='color:red;'>
密码错误!
<a href='$current_name'>点击此处返回前页</a>
</strong></center>";
}
?>
</td></tr>
</table>
</td></tr></table>
</td></tr>
<tr>
<td bgcolor=#FFFFFF valign=middle align=left colspan=2><font color=#555555>
<blockquote><strong>请注意</strong><p><strong>你可以使用绝对路径/相对路径</strong><p>绝对路径请填写完整,UNIX下比如: /home/myaccount/tesdir 在NT下比如: C:/www/testdir 。
相对路径的填写是相对于本脚本存在位置的: 比如本脚本存在于 bmb 目录下,您欲删除 bmb/userdir, 则可以填写 userdir
<strong style='color:red;'>友情提示 - 本程序所位于的绝对路径可能是: <?php echo $current_path['dirname'];
?></strong>
<?php
}
?>
<hr>
<table width="200" align="right" cellspacing="0" cellpadding="0" bgcolor="#448ABD">
<tr><td>
<table width="100%" cellspacing="1" cellpadding="3">
<tr><td bgcolor="#FFFFFF">
By: <a href="http://SpiGer.cn" target=_blank>SpiGer</a>
</td></tr></table>
</td></tr></table>
</td></tr>
</table></td></tr></table>
</td></tr></table></body></html>
<?php
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);
if (rmdir("$dir/$file_name")) echo $_POST['notips'] ? "" : "<strong>$dir/$file_name</strong> -- 成功删除
";
else echo "<strong>$dir/$file_name</strong> -- 失败
";
} else {
if (unlink("$dir/$file_name")) echo $_POST['notips'] ? "" : "$dir/$file_name -- 成功删除
";
else echo "$dir/$file_name -- 失败
";
}
}
}
closedir($dirhandle);
}
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// -----对于使用本软体所带来的任何可能损失,本人概不负责---------------
// -----如果由于SAFE MODE导致UID不匹配而无法删除--------------------
// 可以另外创建一PHP程序,比如名为 copy.php, 内容如下,
// 只有一行: <?php copy("del1.php", "del.php");
// 将本脚本改名为 del1.php 上传至空间,然后运行 copy.php (两者须在同一目录)
// 然后调用 del.php 即可。
$password = "12345"; // 密码
// ========= 以下部分没有特别需要请勿修改 ===========================
$current_path = pathinfo($_SERVER['SCRIPT_FILENAME'] ? $_SERVER['SCRIPT_FILENAME'] : __FILE__);
$current_name = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : "del.php";
@ob_start("ob_gzhandler");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN">
<head>
<title>SpiGer - 目录删除工具</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
body { color: #F9FCFE; font-family: verdana,arial; font-size: 9pt;margin-top:0;margin-left:0;
}
.bmf_table_border{
width: 97%;
background: #F8FCFF;
}
.bmf_table_class{
width: 97%;
background-color: #F8FCFF;
border-left:#448ABD 1px solid;
border-right:#448ABD 1px solid;
}
.bmf_n_table_class{
width: 100%;
background-color: #F8FCFF;
border-left:#448ABD 1px solid;
border-right:#448ABD 1px solid;
border-top:#448ABD 1px solid;
}
td {
border-bottom:1px solid #448ABD;
}
a:link {color: #333333; text-decoration: none;}
a:visited {color: #333333; text-decoration: none;}
a:hover {color: #254394;text-decoration: underline;}
a:active {color: #254394;text-decoration: underline;}
.t { line-height: 1.4;}
td,select,textarea,div,form,option,p{
color:#333333; font-family: tahoma; font-size: 9pt;
}
input { font-family: tahoma; font-size: 9pt; height:22px; }
</style>
</head>
<body>
<table width="95%" cellpadding="0" cellspacing="1" border="0" bgcolor="#14568A" 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="#14568A" colspan="2">
<strong style="color:#FFFFFF;">欢迎使用 文件/目录 删除工具</strong>
</td></tr>
<?php
if (empty($_POST['dir'])) {
?>
<tr>
<td bgcolor="#F9FAFE" valign="middle" colspan="2" align="center"><strong style="color:#428EFF;">请输入您要删除的文件/目录</strong></td></tr>
<tr><td>
<form action="<?php echo $current_name;?>" method="post" style="margin: 0px;">
<table width="85%" align="center" cellspacing="1" cellpadding="0" bgcolor="#448ABD">
<tr><td>
<table width="100%" cellspacing="0" cellpadding="3">
<tr bgcolor="#F8FCFF">
<span style="font-family:verdana;">
<td valign="middle" style="text-align:center;"><strong style="color:#555555;">请输入欲删除的文件/目录</strong>
路径:<input type="text" size="45" name="dir" />
密码:<input type="password" size="45" name="pwd" value="12345" title="密码默认为 12345" />
<input type="checkbox" checked="checked" value="1" name="notips" id="check1" /><label for="check1">不逐个提示成功删除信息</label>
警告:该文件/目录删除后无法恢复!</td></tr>
</table>
</td></tr></table>
</td></tr>
<tr bgcolor="#6DA6D1">
<td valign="middle" colspan="2" align="center"><input type="submit" name="submit" value="确 认" /></td></tr>
<tr>
<td bgcolor="#FFFFFF" valign="middle" align=left colspan=2><font color=#555555>
<strong></form>
请注意</strong><p><strong>你可以使用绝对路径/相对路径</strong><p>绝对路径请填写完整,UNIX下比如: /home/myaccount/tesdir 在NT下比如: C:/www/testdir 。
相对路径的填写是相对于本脚本存在位置的: 比如本脚本存在于 bmb 目录下,您欲删除 bmb/userdir, 则可以填写 userdir
<strong style='color:red;'>友情提示 - 本程序所位于的绝对路径是: <?php echo $current_path['dirname'];
?></strong>
<?php
} else {
?>
<tr>
<td bgcolor="#F9FAFE" valign="middle" colspan="2" align="center"><strong style="color:#428EFF;">执行删除操作</strong></td></tr>
<form action="<?php echo $current_name;?>" method="post" style="margin: 0px;">
<tr><td>
<table width="85%" align="center" cellspacing="1" cellpadding="0" bgcolor="#448ABD">
<tr><td>
<table width="100%" cellspacing="0" cellpadding="3">
<tr bgcolor="#F8FCFF">
<span style="font-family:verdana;">
<?php
if ($_POST['pwd'] == $password) {
$dir = $_POST['dir'];
if (is_dir($dir)) {
kill_dir($dir);
echo "<strong>$dir</strong> -- ";
if (rmdir($dir)) echo "成功删除目录";
else echo "删除目录失败";
echo "
";
} else {
echo "<strong>$dir</strong> -- ";
if (unlink($dir)) echo "成功删除文件";
else echo "删除文件失败";
echo "
";
}
?>
<strong>执行完成 ---- 删除操作</strong>
提醒:目录无法恢复!!!如果由于权限错误,或其他限制,目录可能无法彻底删除
<a href='<?php echo $current_name;?>'>点击此处返回前页</a>
<?php
} else {
echo "<center><strong style='color:red;'>
密码错误!
<a href='$current_name'>点击此处返回前页</a>
</strong></center>";
}
?>
</td></tr>
</table>
</td></tr></table>
</td></tr>
<tr>
<td bgcolor=#FFFFFF valign=middle align=left colspan=2><font color=#555555>
<blockquote><strong>请注意</strong><p><strong>你可以使用绝对路径/相对路径</strong><p>绝对路径请填写完整,UNIX下比如: /home/myaccount/tesdir 在NT下比如: C:/www/testdir 。
相对路径的填写是相对于本脚本存在位置的: 比如本脚本存在于 bmb 目录下,您欲删除 bmb/userdir, 则可以填写 userdir
<strong style='color:red;'>友情提示 - 本程序所位于的绝对路径可能是: <?php echo $current_path['dirname'];
?></strong>
<?php
}
?>
<hr>
<table width="200" align="right" cellspacing="0" cellpadding="0" bgcolor="#448ABD">
<tr><td>
<table width="100%" cellspacing="1" cellpadding="3">
<tr><td bgcolor="#FFFFFF">
By: <a href="http://SpiGer.cn" target=_blank>SpiGer</a>
</td></tr></table>
</td></tr></table>
</td></tr>
</table></td></tr></table>
</td></tr></table></body></html>
<?php
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);
if (rmdir("$dir/$file_name")) echo $_POST['notips'] ? "" : "<strong>$dir/$file_name</strong> -- 成功删除
";
else echo "<strong>$dir/$file_name</strong> -- 失败
";
} else {
if (unlink("$dir/$file_name")) echo $_POST['notips'] ? "" : "$dir/$file_name -- 成功删除
";
else echo "$dir/$file_name -- 失败
";
}
}
}
closedir($dirhandle);
}
评论: 1 | 引用: 0 | 查看次数: -
发表评论


上一篇:
下一篇:
文章来自:
Tags:
相关日志:
回复
|
| APNIC |
| 通过审核]