📄 cleaner.php
字号:
<?php
/**
* Cleaner.php
* Musicbox Version 2.1
* TeaM SCRiPTMAFiA 2005
* This file lets your delete all temporary files created by users in folder /temp
* Also it deletes all files in a folder, leaving the folder itself untouched.
*/
include ('../sources/session.php');
/**
* User not an administrator, redirect to main page
* automatically.
*/
if(!$session->isAdmin())
{
header("Location: ../index.php");
die();
}
/*
* @param $dir string The path of the folder whose contents will be deleted
*/
function delete_files($dir)
{
static $count;
$count++;
$dh=opendir($dir);
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) {
unlink($fullpath);
} else {
delete_files($fullpath);
}
}
}
closedir($dh);
if ($count != 1)
rmdir($dir);
$count--;
}
/**
* Handle Form Submission
*/
if (!empty($_POST['directory']))
delete_files($_POST['directory']);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Delete Files</title>
<link rel="stylesheet" type="text/css" media="all" href="../template/css/admintheme.css" />
</head>
<body>
<table width=\"90%\" align=\"center\" class='tdrow2'>
<tr>
<td>
<h1>Delete All Temporary Files</h1>
<p></p>
<p>Please Set the temp folder permissions to 777 or the cleaner will not work.</p>
<form name="delete_files" action="" method="post">
<p>Full path of directory to delete <br>eg: /home/username/public_html/musicboxv2/temp<br><input type="text" name="directory" value="<?=@$_POST['directory']?>"></p>
<input type="submit" name="submit" value="Delete Contents">
</form></td></tr></table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -