Вход Регистрация
Файл: region_clean/forum/admin.php
Строк: 373
<?php
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################

require_once "../start.php";
require_once 
"../sid.php";

header('Cache-Control: no-store, no-cache, must-revalidate');
if (
$ver == "wml"header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else 
header("Content-Type:text/html; charset=UTF-8");

require_once 
"../inc.php";
$link connect_db();
list(
$row$id$ps$fsize1$fsize2) = check_login($link);
require_once 
"../version.php";

if (
$ver == "wml") {
echo 
$xml;
echo 
$dtd;
echo 
"<wml>
      <card id="
index" title="Управление разделами форума">
      <p align="
center">";
} else {
echo 
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"";
echo ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">";
echo "<html xmlns="http://www.w3.org/1999/xhtml">
      
<head><link rel="stylesheet" type="text/css" href="../css/$css.css"/>
      <
title>Управление разделами форума</title>
      <
meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
      <
div align="center">";
}

$config_bookpost = 5;

$day = date("d.m.y");
$timer = date("H:i");
$idsd = $_SESSION['id'];

if (
$row["level"] < 7) {
if (
$ver == "wml") {
echo 
$xml;
echo 
$dtd;
echo "
<wml>n
      
<card id="error" title="Ошибка доступа" ontimer="enter.php?$ses&amp;ref=$ref"><timer value="15"/>
      <
p align="center">n";
} else {
echo "
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <
html xmlns="http://www.w3.org/1999/xhtml">
      <
head><link rel="stylesheet" type="text/css" href="../css/$scss.css"/>
      <
title>Ошибка доступа</title>
      <
meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
      <
div align="center">";
}
echo 
$fsize1;
echo 'Тебе сюда нельзя!<br/>';
echo 
$fsize1;
include_once '../foot.php';
mysql_close (
$link);
exit;
}

echo '<div class = "
c4">Управление разделами форума</div><br/>';

if (
$action == '') {

                echo 'Все форумы<br/>';
                echo 
$divide;
                
$q = mysql_query("select from `forumwhere type='r' order by realid");
                while (
$mass = mysql_fetch_assoc($q))
                {
                
$mass['id'] = intval($mass['id']);
                    
$colraz = mysql_query("select from `forumwhere type='f' and refid='" . $mass['id'] . "';");
                    
$colraz1 = mysql_num_rows($colraz);
                    
$d = $i / 2;
                    
$d1 = ceil($d);
                    
$d2 = $d1 - $d;
                    
$d3 = ceil($d2);
                    if (
$d3 == 0)
                    {
                        
$div = "<div class='f'>";
                    }
                    else
                    {
                        
$div = "<div class='e'>";
                    }
                    
$ri = mysql_query("select from `forumwhere type='r' and  realid>'" . $mass['realid'] . "';");
                    
$rei = mysql_num_rows($ri);
                    
$ri1 = mysql_query("select from `forumwhere type='r' and realid<'" . $mass['realid'] . "';");
                    
$rei1 = mysql_num_rows($ri1);
                    echo 
$div."<a href='admin.php?action=razdel&amp;rid=" . $mass['id'] . "&amp;".$ses."&amp;ref=".$ref."'>$mass[text]</a> ($colraz1)<br/>";
                    if (
$rei1 != 0)
                    {
                        echo "
<a href='admin.php?action=uprazdel&amp;rid=" . $mass['id'] . "&amp;".$ses."&amp;ref=".$ref."'>Вверх</a> | ";
                    }
                    if (
$rei != 0)
                    {
                        echo "
<a href='admin.php?action=dwrazdel&amp;rid=" . $mass['id'] . "&amp;".$ses."&amp;ref=".$ref."'>Вниз</a> | ";
                    }
                    echo "
<a href='admin.php?action=edrazdel&amp;rid=" . $mass['id'] . "&amp;".$ses."&amp;ref=".$ref."'>Edit</a> | <a href='admin.php?action=delrazdel&amp;rid=" . $mass['id'] . "&amp;".$ses."&amp;ref=".$ref."'>Del</a>";
                    echo '</div>';
                    ++
$i;
                }
                echo 
$divide;
                echo "
<a href='admin.php?action=addcat&amp;".$ses."&amp;ref=".$ref."'>Создать категорию</a><br/><br/>";
}
if (
$action == "razdel") {

if (empty(
$_GET['rid']))
            {
    echo 'ID категории отсутствует!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$rid = intval(check($_GET['rid']));
            
$typ = mysql_query("select from `forumwhere id='" . $rid . "';");
            
$ms = mysql_fetch_array($typ);
            if (
$ms['type'] != "f" and $ms['type'] != "r")
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
                echo 
$divide;
                echo 'Все подфорумы<br/>';
                
$q = mysql_query("select from `forumwhere type='f' AND refid='".$rid."' order by realid ;");
                while (
$mass = mysql_fetch_array($q))
                {
                
$mass['id'] = intval($mass['id']);
                    
$colraz = mysql_query("select from `forumwhere type='t' and refid='" . $mass['id'] . "';");
                    
$colraz1 = mysql_num_rows($colraz);
                    
$d = $i / 2;
                    
$d1 = ceil($d);
                    
$d2 = $d1 - $d;
                    
$d3 = ceil($d2);
                    if (
$d3 == 0)
                    {
                        
$div = "<div class='f'>";
                    }
                    else
                    {
                        
$div = "<div class='e'>";
                    }
                    
$ri = mysql_query("select from `forumwhere type='f' and  realid>'" . $mass['realid'] . "';");
                    
$rei = mysql_num_rows($ri);
                    
$ri1 = mysql_query("select from `forumwhere type='f' and realid<'" . $mass['realid'] . "';");
                    
$rei1 = mysql_num_rows($ri1);
                    echo "
$div$mass[text] ($colraz1)<br/>";
                    if (
$rei1 != 0)
                    {
                        echo "
<a href='admin.php?action=upforum&amp;fid=" . $mass['id'] . "&amp;".$ses."&amp;ref=".$ref."'>Вверх</a> | ";
                    }
                    if (
$rei != 0)
                    {
                        echo "
<a href='admin.php?action=dwforum&amp;fid=" . $mass['id'] . "&amp;".$ses."&amp;ref=".$ref."'>Вниз</a> | ";
                    }
                    echo "
<a href='admin.php?action=edforum&amp;fid=" . $mass['id'] . "&amp;".$ses."&amp;ref=".$ref."'>Edit</a> | <a href='admin.php?action=delforum&amp;fid=" . $mass['id'] . "&amp;".$ses."&amp;ref=".$ref."'>Del</a>";
                    echo '</div>';
                    ++
$i;
                }
                echo 
$divide;
                echo "
<a href='admin.php?action=addforum&amp;".$ses."&amp;ref=".$ref."'>Создать форум</a><br/><br/>";

}
//---------------------------------------- РЕДАКТИРОВАНИЕ -------------------------------------------//
if (
$action == 'addcat') {

$id = $row['id'];
$r = mysql_query("select id,user,level from users where id='$id'");
$arr = mysql_fetch_array($r);
$login = $arr['user'];
$usid = $arr['id'];
$lev = $arr['level'];

echo 'Создание форума: <b>'.
$dt[1].'</b><br/><br/>';

if (
$ver != "wml") {
echo'<form action="
admin.php?action=addcatgo&amp;'.$ses.'&amp;ref='.$ref.'" method="POST">';

echo 'Заголовок категории:<br/>
      <input name="
names" value=""/><br/>
      Краткое описание категории:<br/>
      <input name="
about" value=""/><br/>
      <br/><input type="
submit" class="ibutton" value="Отправить"></form>';
echo 
$divide;
} else {
echo '<br/>--------------------<br/>
      Заголовок категории:<br/>
      <input name="
names" value=""/><br/>
      Краткое описание категории:<br/>
      <input name="
about" value=""/><br/>
      <anchor>Отправить!
      <go href="
admin.php?action=addcatgo&amp;'.$ses.'&amp;ref='.$ref.'" method="post">
      <postfield name="
names" value="$(names)"/>
      <postfield name="
about" value="$(about)"/>
      </go></anchor><br/>--------------------<br/>';
}
}

//---------------------------------------- ИЗМЕНЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if (
$action == 'addcatgo') {

$names = mysql_real_escape_string(check($names));
$about = mysql_real_escape_string(check($about));

    if (empty(
$_POST['names']))
    {
    echo 'Название категории отсутствует!<br/><br/>
         <a href="
admin.php?action=addcat&amp;'.$ses.'&amp;ref='.$ref.'">Назад</a><br/>
         <a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
    }

$q = mysql_query("select from `forumwhere type='r' order by realid desc;");
                
$q1 = mysql_num_rows($q);
                if (
$q1 == 0)
                {
                    
$rid = 1;
                }
                else
                {
                    while (
$arr = mysql_fetch_assoc($q))
                    {
                        
$arr1[] = $arr['realid'];
                    }
                    
$rid = $arr1[0] + 1;
                }

mysql_query ("
SELECT `type`='t' FROM `forumWHERE `text`='".$names."'");
if (mysql_affected_rows() != 0) {
echo 'Ошибка! Такой раздел уже существует.<br/><br/>';
include_once '../foot.php';
break;
}

mysql_query("
insert into `forumvalues(0,'','r','','','','".$rid."','','','" . $names . "','','" . $about . "','','','','','','','','','','','','','');");

echo 'Раздел создан!<br/><br/>';
}

//---------------------------------------- РЕДАКТИРОВАНИЕ -------------------------------------------//
if (
$action == 'addforum') {

$id = $row['id'];
$r = mysql_query("select id,user,level from users where id='$id';");
$arr = mysql_fetch_array($r);
$login = $arr['user'];
$usid = $arr['id'];
$lev = $arr['level'];

echo 'Создание форума: <b>'.
$dt[1].'</b><br/><br/>';

if (
$ver != "wml") {
echo '<form action="
admin.php?action=addforumgo&amp;'.$ses.'&amp;ref='.$ref.'" method="POST">
      Заголовок форума:<br/>
     <input name="
names" value=""/><br/>
      Краткое описание форума:<br/>
     <input name="
about" value=""/><br/>
      Выбери категорию:<br/>';
                
$fr = mysql_query("select from `forumwhere type='r';");
                while (
$fr1 = mysql_fetch_assoc($fr))
                {
                    echo "
<input type='radio' name='r' value='" . $fr1['id'] . "'/>$fr1[text]<br/>";
                }

echo '<br/><input type="
submit" class="ibutton" value="Отправить"></form>';
echo 
$divide;
} else {

echo '<br/>--------------------<br/>ТОЛЬКО В xHTML СХЕМЕ!!!';
}
}

if (
$action == "addforumgo") {

$names = mysql_real_escape_string(check($names));
$about = mysql_real_escape_string(check($about));

if (empty(
$r)) {
echo 'Ошибка! Не выбрана категория!<br/>';
include_once '../foot.php';
break;
}
    if (empty(
$_POST['names']))
    {
    echo 'Название форума отсутствует!<br/><br/>
          <a href="
admin.php?action=addforum&amp;'.$ses.'&amp;ref='.$ref.'">Назад</a><br/>
          <a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
    }

$q = mysql_query("select from `forumwhere type='f' order by realid desc;");
                
$q1 = mysql_num_rows($q);
                if (
$q1 == 0)
                {
                    
$rid = 1;
                }
                else
                {
                    while (
$arr = mysql_fetch_array($q))
                    {
                        
$arr1[] = $arr['realid'];
                    }
                    
$rid = $arr1[0] + 1;
                }

mysql_query ("
SELECT `idFROM `forumWHERE `type`='f' AND `text`='".$names."'");
if (mysql_affected_rows() != 0) {
echo 'Ошибка! Такой подфорум уже существует.<br/><br/>';
include_once '../foot.php';
break;
}

$riz = intval(check($r));
mysql_query("
insert into `forumvalues(0,'" . $riz . "','f','','','','".$rid."','','','" . $names . "','','" . $about . "','','','','','','','','','','','','','');");

echo 'Форум создан!<br/><br/>';
}

if (
$action == 'upforum') {

            if (empty(
$_GET['fid']))
            {
    echo'ID категории отсутствует!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$fid = intval($_GET['fid']);
            
$typ = mysql_query("select from `forumwhere id='" . $fid . "';");
            
$ms = mysql_fetch_array($typ);
            if (
$ms['type'] != "f" and $ms['type'] != "r")
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$ms['refid'] = intval($ms['refid']);
            
$ms['realid'] = intval($ms['realid']);
            
$ri = mysql_query("select from `forumwhere type='f' and refid='" . $ms['refid'] . "' and realid<'" . $ms['realid'] . "' order by realid desc;");
            
$rei = mysql_num_rows($ri);
            if (
$rei == 0)
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            while (
$zid = mysql_fetch_assoc($ri))
            {
                
$arr[] = $zid['id'];
            }
            
$tr = mysql_query("select from `forumwhere type='f' and id='" . $arr[0] . "';");
            
$tr1 = mysql_fetch_array($tr);
            
$real1 = $tr1['realid'];
            
$real2 = $ms['realid'];
            
$fid = intval($fid);
            
$real1 = intval($real1);
            
$arr[0] = intval($arr[0]);
            
$real2 = intval($real2);
            mysql_query("
update `forumset  realid='" . $real1 . "' where id='" . $fid . "';");
            mysql_query("
update `forumset  realid='" . $real2 . "' where id='" . $arr[0] . "';");

    echo 'Готово!<br/><br/>';

}

if (
$action == 'dwforum') {

            if (empty(
$_GET['fid']))
            {
    echo 'ID категории отсутствует!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$fid = intval($_GET['fid']);
            
$typ = mysql_query("select from `forumwhere id='" . $fid . "';");
            
$ms = mysql_fetch_array($typ);
            if (
$ms['type'] != "f" and $ms['type'] != "r")
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$ri = mysql_query("select from `forumwhere type='f' and refid='" . $ms['refid'] . "' and realid>'" . $ms['realid'] . "' order by realid desc;");
            
$rei = mysql_num_rows($ri);
            if (
$rei == 0)
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            while (
$zid = mysql_fetch_assoc($ri))
            {
                
$arr[] = $zid['id'];
            }
            
$tr = mysql_query("select from `forumwhere type='f' and id='" . $arr[0] . "';");
            
$tr1 = mysql_fetch_array($tr);
            
$real1 = $tr1['realid'];
            
$real2 = $ms['realid'];
            
$fid = intval($fid);
            
$real1 = intval($real1);
            
$arr[0] = intval($arr[0]);
            
$real2 = intval($real2);
            mysql_query("
update `forumset  realid='" . $real1 . "' where id='" . $fid . "';");
            mysql_query("
update `forumset  realid='" . $real2 . "' where id='" . $arr[0] . "';");

    echo 'Готово!<br/><br/>';

}

if (
$action == 'edforum') {

 if (empty(
$_GET['fid']))
            {
    echo 'ID категории отсутствует!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$fid = intval($_GET['fid']);
            
$typ = mysql_query("select from `forumwhere id='" . $fid . "';");
            
$ms = mysql_fetch_array($typ);
            if (
$ms['type'] != "f" and $ms['type'] != "r")
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }

      if (
$ver != "wml") {
echo'<form action="
admin.php?action=edforumgo&amp;fid='.$fid.'&amp;'.$ses.'&amp;ref='.$ref.'" method="POST">';

echo 'Заголовок форума:<br/>
      <input name="
names" value="' . $ms['text'] . '"/><br/>
      Краткое описание форума:<br/>
      <input name="
about" value="' . $ms['about'] . '"/><br/>
      <br/><input type="
submit" class="ibutton" value="Отправить"></form>';
      echo 
$divide;
} else {
echo '<br/>--------------------<br/>
       Заголовок форума:<br/>
      <input name="
names" value="' . $ms['text'] . '"/><br/>
       Краткое описание форума:<br/>
      <input name="
about" value="' . $ms['about'] . '"/><br/>

      <anchor>Отправить!
      <go href="
admin.php?action=edforumgo&amp;fid='.$fid.'&amp;'.$ses.'&amp;ref='.$ref.'" method="post">
      <postfield name="
names" value="$(names)"/>
      <postfield name="
about" value="$(about)"/>
      </go></anchor><br/>--------------------<br/>';
}
}

if (
$action == 'edforumgo') {

$names = mysql_real_escape_string(check(trim($_POST['names'])));
$about = mysql_real_escape_string(check(trim($_POST['about'])));
$fid = intval($_GET['fid']);

if (empty(
$names))
            {
    echo 'Не введено название!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }

mysql_query("
update `forumset text='" . $names . "',about='" . $about . "' where id='" . $fid . "';");

echo 'Готово!<br/><br/>';

}

if (
$action == 'delforum') {

if (empty(
$_GET['fid']))
            {
    echo 'ID категории отсутствует!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$fid = intval($_GET['fid']);
            
$typ = mysql_query("select from `forumwhere id='" . $fid . "';");
            
$ms = mysql_fetch_array($typ);
            if (
$ms['type'] != "f" and $ms['type'] != "r")
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }

    
$sql = mysql_query("SELECT id FROM forum WHERE refid IN(SELECT id FROM forum WHERE refid '$fid')");
    
$_del = '';
    while (false != (
$res = mysql_fetch_assoc($sql))){
        
$_del .= $res['id'].',';
    }
    if(
$_del != '') mysql_query("DELETE FROM forum WHERE id IN(".rtrim($_del, ',').")");
    mysql_query("
DELETE FROM forum WHERE id '$fid' OR refid '$fid'");
    echo 'Готово!<br/><br/>';
}

if (
$action == 'uprazdel') {

            if (empty(
$_GET['rid']))
            {
    echo 'ID категории отсутствует!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$rid = intval($_GET['rid']);
            
$typ = mysql_query("select from `forumwhere id='" . $rid . "';");
            
$ms = mysql_fetch_array($typ);
            if (
$ms['type'] != "f" and $ms['type'] != "r")
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$ri = mysql_query("select from `forumwhere type='r' and refid='" . $ms['refid'] . "' and realid<'" . $ms['realid'] . "' order by realid desc;");
            
$rei = mysql_num_rows($ri);
            if (
$rei == 0)
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            while (
$zid = mysql_fetch_assoc($ri))
            {
                
$arr[] = $zid['id'];
            }
            
$tr = mysql_query("select from `forumwhere type='r' and id='" . $arr[0] . "';");
            
$tr1 = mysql_fetch_array($tr);
            
$real1 = $tr1['realid'];
            
$real2 = $ms['realid'];
            
$rid = intval($rid);
            
$real1 = intval($real1);
            
$arr[0] = intval($arr[0]);
            
$real2 = intval($real2);
            mysql_query("
update `forumset  realid='" . $real1 . "' where id='" . $rid . "';");
            mysql_query("
update `forumset  realid='" . $real2 . "' where id='" . $arr[0] . "';");

    echo 'Готово!<br/><br/>';

}

if (
$action == 'dwrazdel') {

           if (empty(
$_GET['rid']))
            {
    echo 'ID категории отсутствует!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$rid = intval($_GET['rid']);
            
$typ = mysql_query("select from `forumwhere id='" . $rid . "';");
            
$ms = mysql_fetch_array($typ);
            if (
$ms['type'] != "f" and $ms['type'] != "r")
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$ri = mysql_query("select from `forumwhere type='r' and refid='" . $ms['refid'] . "' and realid>'" . $ms['realid'] . "' order by realid;");
            
$rei = mysql_num_rows($ri);
            if (
$rei == 0)
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            while (
$zid = mysql_fetch_assoc($ri))
            {
                
$arr[] = $zid['id'];
            }
            
$tr = mysql_query("select from `forumwhere type='r' and id='" . $arr[0] . "';");
            
$tr1 = mysql_fetch_array($tr);
            
$real1 = $tr1['realid'];
            
$real2 = $ms['realid'];
            
$rid = intval($rid);
            
$real1 = intval($real1);
            
$arr[0] = intval($arr[0]);
            
$real2 = intval($real2);
            mysql_query("
update `forumset  realid='" . $real1 . "' where id='" . $rid . "';");
            mysql_query("
update `forumset  realid='" . $real2 . "' where id='" . $arr[0] . "';");

    echo 'Готово!<br/><br/>';

}

if (
$action == 'edrazdel') {

if (empty(
$_GET['rid']))
            {
    echo 'ID категории отсутствует!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$rid = intval($_GET['rid']);
            
$typ = mysql_query("select from `forumwhere id='" . $rid . "';");
            
$ms = mysql_fetch_array($typ);
            if (
$ms['type'] != "f" and $ms['type'] != "r")
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }

      if (
$ver != "wml") {
echo '<form action="
admin.php?action=edrazdelgo&amp;rid='.$rid.'&amp;'.$ses.'&amp;ref='.$ref.'" method="POST">
      Заголовок категории:<br/>
      <input name="
names" value="' . $ms['text'] . '"/><br/>
      Краткое описание категории:<br/>
      <input name="
about" value="' . $ms['about'] . '"/><br/>
      <br/><input type="
submit" class="ibutton" value="Отправить"></form>';
echo 
$divide;
} else {
echo '<br/>--------------------<br/>
      Заголовок категории:<br/>
      <input name="
names" value="' . $ms['text'] . '"/><br/>
      Краткое описание категории:<br/>
      <input name="
about" value="' . $ms['about'] . '"/><br/>
      <anchor>Отправить!
      <go href="
admin.php?action=edrazdelgo&amp;rid='.$rid.'&amp;'.$ses.'&amp;ref='.$ref.'" method="post">
      <postfield name="
names" value="$(names)"/>
      <postfield name="
about" value="$(about)"/>
      </go></anchor><br/>--------------------<br/>';
}
}

if (
$action == 'edrazdelgo') {

$names = mysql_real_escape_string(check(trim($_POST['names'])));
$about = mysql_real_escape_string(check(trim($_POST['about'])));
$rid = intval($_GET['rid']);

if (empty(
$names))
            {
    echo 'Не введено название!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }

mysql_query("
update `forumset text='" . $names . "',about='" . $about . "' where id='" . $rid . "';");

echo 'Готово!<br/><br/>';

}

if (
$action == 'delrazdel') {

if (empty(
$_GET['rid']))
            {
    echo 'ID категории отсутствует!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }
            
$rid = intval($_GET['rid']);
            
$typ = mysql_query("select from `forumwhere id='" . $rid . "';");
            
$ms = mysql_fetch_array($typ);
            if (
$ms['type'] != "f" and $ms['type'] != "r")
            {
    echo 'Произошла ошибка!!!<br/><br/>';
    echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>';
    include_once '../foot.php';
    exit;
            }

    //Собираем список подфорумов
    
$sql = mysql_query("SELECT id FROM forum WHERE id '$rid' AND type='r'");
    while (false != (
$res = mysql_fetch_assoc($sql))) {
        
$arr[] = $res['id'];
    }
    
$listPodForum = rtrim(implode(',', $arr), ',');
    //Собираем список тем
    
$sql = mysql_query("SELECT id FROM forum WHERE refid IN($listPodForum) AND type='f'");
    while (false != (
$res = mysql_fetch_assoc($sql))) {
        
$arr[] = $res['id'];
    }
    
$listTheme = rtrim(implode(',', $arr), ',');
    
$sql = mysql_query("SELECT id FROM forum WHERE refid IN($listTheme) AND type='t'");
    while (false != (
$res = mysql_fetch_assoc($sql))) {
        
$arr[] = $res['id'];
    }
    
$listMes = rtrim(implode(',', $arr), ',');
    //Удаляем
    mysql_query("
DELETE FROM forum WHERE (id '$rid') OR (refid'$rid') OR (refid IN($listPodForum) OR refid IN($listTheme) OR refid IN($listMes))");
    echo 'Готово!<br/><br/>';

}
echo '<div class = "
d1"><a href="admin.php?'.$ses.'&amp;ref='.$ref.'">К управлению</a><br/>
      <a href="
../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a></div>';
include_once '../foot.php';
mysql_close(
$link);
ob_end_flush();
exit;
?>
Онлайн: 2
Реклама