Файл: modules/phpcodes/del_folder.php
Строк: 19
<?php
$title = 'Полезые PHP коды | Удаление папки';
include_once($_SERVER["DOCUMENT_ROOT"].'/style/head.php');
mode('user');
level(1);
$_GET['id'] = abs(intval($_GET['id']));
if($db->query("SELECT `id` FROM `phpcodes_folders` WHERE `id`='".$_GET['id']."'")->num_rows==0){
error('Папки не сущетвует.');
}
$folder = $db->query("SELECT * FROM `phpcodes_folders` WHERE `id`='".$_GET['id']."'")->fetch_assoc();
?>
<div class="title"><a href="/phpcodes">Полезные PHP коды</a> | <a href="/phpcodes/folder/<?=$folder['id']?>"><?=htmlspecialchars($folder['name'])?></a> | Удаление</div>
<?
if(isset($_POST['yes'])){
$db->query("DELETE FROM `phpcodes_folders` WHERE `id`='".$_GET['id']."'");
#$db->query("DELETE FROM `phpcodes_codes` WHERE `folder`='".$_GET['id']."'");
$q = $db->query("SELECT `id` FROM `phpcodes_codes` WHERE `folder`='".$_GET['id']."'");
while($c = $q->fetch_assoc()){
$db->query("DELETE FROM `phpcodes_comm` WHERE `code`='".$c['id']."'");
$db->query("DELETE FROM `phpcodes_codes` WHERE `id`='".$c['id']."'");
}
success('Папка успешно удалена.');
include_once($_SERVER["DOCUMENT_ROOT"].'/style/foot.php');
exit();
}elseif(isset($_POST['no'])){
header('location:/phpcodes');
}
?>
<div class="text">
<form action="" method="POST">
Вы действительно хотите удалить эту папку (<a href="/phpcodes/folder/<?=$_GET['id']?>"><?=htmlspecialchars($folder['name'])?></a>)?<br/>
<input type="submit" name="yes" value="Да"> <input type="submit" name="no" value="Нет">
</form>
</div>
<?
include_once($_SERVER["DOCUMENT_ROOT"].'/style/foot.php');
?>