File size: 1.75Kb
<?php
include_once '../../sman/includs/configurations.php';
include_once '../../sman/includs/head.php';
if (isset($_GET['path'])) {
echo '<center>Вы подтверждаете удаление папки? <a href = "?path_to='.htmlspecialchars($_GET['path']).'">да</a> / <a href = "/sman/'.FILE_OPT.'.php?path='.$back.'">нет</a></center>';
} else if (isset($_GET['path_to'])) {
echo '<div class="vhod">';
$path_name = htmlspecialchars($_GET['path_to']);
function clear_delete($path_name) {
$files_del = scandir(ROOT.'/'.$path_name);
$files_del = array_slice($files_del, 2);
$files_del = array_diff($files_del, array(''));
foreach ($files_del as $key => $value) {
if (is_dir(ROOT.$path_name.'/'.$files_del[$key]))
clear_delete($path_name.'/'.$files_del[$key]);
if (is_dir(ROOT.$path_name.'/'.$files_del[$key])) {
if (rmdir(ROOT.$path_name.'/'.$files_del[$key])) {
$delete = '<span style = "color: green;">Удалено</span>';
} else
$delete = '<span style = "color: red;">Ошибка!</span>';
}
if (is_file(ROOT.$path_name.'/'.$files_del[$key])) {
if (unlink(ROOT.$path_name.'/'.$files_del[$key])) {
$delete = '<span style = "color: green;">Удалено</span>';
} else
$delete = '<span style = "color: red;">Ошибка!</span>';
}
echo '<div class = "menu"><a> '.$path_name.'/'.$files_del[$key].' - '.$delete.' </a></div>';
}
if (rmdir(ROOT.$path_name))
echo '<div class = "menu"><a> '.$path_name.' - <span style = "color: green;">Папка удалена</span> </a></div>';
}
clear_delete($path_name);
echo '</div>';
include_once '../../sman/includs/foot.php';
} else {
header("Location: /sman/index.php");
exit;
}
include_once '../../sman/includs/foot.php';
?>