Файл: forumm/del_them_ok.php
Строк: 16
<?
$_SESSION['mother_them_del']=$forum['mother'];
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `id` = '$forum[id]' AND `type` = 'tema' LIMIT 1"),0)!=0)
{
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `name` = 'Песочница, Архив' AND `type` = 'forum' LIMIT 1"),0)==0)
{
mysql_query("INSERT INTO `forum` (`id_comm`, `mother`, `type`, `name`, `time`, `text`, `count`) values ('0', '0', 'forum', 'Песочница, Архив', '$time', '', '0')");
$id_forum=mysql_insert_id();
$id_forum=mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = '$id_forum' AND `type` = 'forum' LIMIT 1"));
}
else $id_forum=mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `name` = 'Песочница, Архив' AND `type` = 'forum' LIMIT 1"));
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `name` = 'Архив тем' AND `type` = 'razdel' AND `mother` = '$id_forum[id]' LIMIT 1"),0)==0)
{
mysql_query("INSERT INTO `forum` (`id_comm`, `type`, `name`, `time`, `text`, `count`, `mother`) values ('0', 'razdel', 'Архив тем', '$time', '', '$id_forum[count]/$id_forum[id]', '$id_forum[id]')");
$id_razdel=mysql_insert_id();
$id_razdel=mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = '$id_razdel' AND `type` = 'razdel' AND `mother` = '$id_forum[id]' LIMIT 1"));
}
else $id_razdel=mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `name` = 'Архив тем' AND `type` = 'razdel' AND `mother` = '$id_forum[id]' LIMIT 1"));
mysql_query("UPDATE `forum` SET `mother` = '$id_razdel[id]', `up` = '0', `count` = '$id_razdel[count]/$id_razdel[id]', `close_id_user` = '$user[id]', `close` = '1' WHERE `id` = '$forum[id]' LIMIT 1");
$back=$_SESSION['mother_them_del'];
header("location: /forumm/?id=$back");
}
else header("Location: /forumm");
?>