<?php
Defined('ADMIN_S_S') or die ('Доступ запрещен!!!');
echo '!Перед удалением удалите файлы из раздела!<br />';
if (!isset($_POST[el]))
{
// Запуск генератора
$fp = fopen ("files/namekat.txt", "r");
$buffer = fread($fp, filesize("files/namekat.txt"));
fclose ($fp);
$count = explode("|", $buffer);
echo "<form name='red' action='$_SERVER[self]' method='post'>";
echo 'Выберите раздел для удаления.<br />';
echo '<select size="1" name="el">';
$i=0;
while ($count[$i] != "")
{
echo "<option value='$count[$i]'>$count[$i]</option>";
$i++;
};
echo '</select><br />';
echo '<input name="inc" type="hidden" value="del_kat.php">';
echo '<input type="submit" value="Удалить">';
echo '</form>';
}
else
{
$fp = fopen ("files/namekat.txt", "r");
$buffer = fread($fp, filesize('files/namekat.txt'));
fclose ($fp);
if (eregi("(\|)($_POST[el])",$buffer))
{
// редактирование
$data = fopen ("files/namekat.txt", "r");
$dan = fread($data, filesize("files/namekat.txt"));
fclose ($data);
$dan = str_replace("|$_POST[el]","",$dan) ;
$data = fopen ("files/namekat.txt", "w");
fwrite ($data, $dan);
fclose ($data);
// конец
$file_s = $_POST[el];
$file_s=strtr($file_s,"абвгдеёзийклмнопрстуфхъыэ_",
"abvgdeeziyklmnoprstufh'iei");
$file_s=strtr($file_s,"АБВГДЕЁЗИЙКЛМНОПРСТУФХЪЫЭ_",
"ABVGDEEZIYKLMNOPRSTUFH'IEI");
$file_s=strtr($file_s,
array(
"ж"=>"zh", "ц"=>"ts", "ч"=>"ch", "ш"=>"sh",
"щ"=>"shch","ь"=>"", "ю"=>"yu", "я"=>"ya",
"Ж"=>"ZH", "Ц"=>"TS", "Ч"=>"CH", "Ш"=>"SH",
"Щ"=>"SHCH","Ь"=>"", "Ю"=>"YU", "Я"=>"YA",
"ї"=>"i", "Ї"=>"Yi", "є"=>"ie", "Є"=>"Ye"
));
$file_s = str_replace(" ","_",$file_s);
$file_s = str_replace("\\","_",$file_s);
$file_s = str_replace("\"","_",$file_s);
$file_s = str_replace("'","_",$file_s);
$file_s = str_replace(".","_",$file_s);
$file_s = str_replace("-","_",$file_s);
$file_s = str_replace("/","_",$file_s);
$file_s = str_replace("#","_",$file_s);
$file_s = str_replace("=","_",$file_s);
$file_s = str_replace(">","_",$file_s);
$file_s = str_replace("<","_",$file_s);
$file_s = str_replace("|","_",$file_s);
$mdh = $file_s;
unlink("files/count/$mdh.txt");
unlink("files/rasd/$mdh");
echo 'Успешно. <a href="/admin.php?int=files/adm/ind.php">Далее</a>';
}
else
{
echo 'Первый раздел можно только редактировать!';
};
};
?>