Файл: forum/topic-sett.php
Строк: 153
<?
include_once('../apahe/ini.php');
$forum_u = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum-u` WHERE `id` = '".int($_GET['id'])."'"));
$urlup='/forum/index';
$inc['title'] = 'Форум - настройки темы';
include_once('../apahe/top.php');
if (!isset($apache)){
header ('location: /input.dll');
exit;
}
if (!$forum_u){
header ('location: /forum/index.dll');
exit;
}
$forum = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum` WHERE `id` = '".int($forum_u['id-forum'])."'"));
$forum_r = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum-r` WHERE `id` = '".int($forum_u['id-forum-r'])."'"));
echo '<div class="main-text">';
echo '<a href="index.dll" title="Форум">Форум</a> | ';
echo '<a href="forum-'.int($forum['id']).'.dll" title="'.$forum['name'].'">'.$forum['name'].'</a> | ';
echo '<a href="forum-r-'.int($forum_r['id']).'.dll" title="'.$forum_r['name'].'">'.$forum_r['name'].'</a> | ';
echo '<a href="topic-'.int($forum_u['id']).'.dll" title="'.$forum_u['name'].'">'.$forum_u['name'].'</a>';
echo '</div>';
switch ($_GET['selest']){
default:
if ($apache['id']==$forum_u['id-apache']){
echo '<a class="main-href" href="topic-sett-'.int($forum_u['id']).'.dll?selest=name" title="Изменить название темы">';
icons('topic-sett');
echo 'Изменить название темы</a>';
if ($forum_u['act']==0){
echo '<a class="main-href" href="topic-sett-'.int($forum_u['id']).'.dll?selest=act" title="Закрыть тему">';
icons('topic-sett');
echo 'Закрыть тему</a>';
}else{
echo '<a class="main-href" href="topic-sett-'.int($forum_u['id']).'.dll?selest=act" title="Открыть тему">';
icons('topic-sett');
echo 'Открыть тему</a>';
}
if ($apache['level']>=2){
echo '<a class="main-href" href="topic-sett-'.int($forum_u['id']).'.dll?selest=delete" title="Удалить тему">';
icons('topic-sett');
echo 'Удалить тему</a>';
}
}else if ($apache['level']>=2){
echo '<a class="main-href" href="topic-sett-'.int($forum_u['id']).'.dll?selest=name" title="Изменить название темы">';
icons('topic-sett');
echo 'Изменить название темы</a>';
if ($forum_u['act']==0){
echo '<a class="main-href" href="topic-sett-'.int($forum_u['id']).'.dll?selest=act" title="Закрыть тему">';
icons('topic-sett');
echo 'Закрыть тему</a>';
}else{
echo '<a class="main-href" href="topic-sett-'.int($forum_u['id']).'.dll?selest=act" title="Открыть тему">';
icons('topic-sett');
echo 'Открыть тему</a>';
}
echo '<a class="main-href" href="topic-sett-'.int($forum_u['id']).'.dll?selest=delete" title="Удалить тему">';
icons('topic-sett');
echo 'Удалить тему</a>';
}else{
header('Location: /forum/topic-'.int($forum_u['id']).'.dll');
}
break;
case 'name':
if ($apache['id']==$forum_u['id-apache']){
if (isset($_POST['edit-topic-ok'])){
$name = txt($_POST['name']);
if (empty($name)) $err .= 'Не введёно имя темы.</br>';
if (!empty($message) && (strlen($message) < 2 || strlen($message) > 128)) $err .= 'Неверная длина имени.</br>';
if (!isset($err)){
mysql_query("UPDATE `forum-u` SET `name` = '".$name."' WHERE `id` = '".int($forum_u['id'])."'");
header('Location: /forum/topic-'.int($forum_u['id']).'.dll');
}}
error($err);
echo '<div class="main-href"><form method="post" action="topic-sett-'.int($forum_u['id']).'.dll?selest=name">';
echo 'Название темы:</br><input type="text" name="name" placeholder="Мах 128 символов" maxlength="128" value="'.$forum_u['name'].'"/></br>';
echo '<input type="submit" name="edit-topic-ok" title="Изменить" value="Изменить тему">';
echo '</form></div>';
}else if ($apache['level']>=2){
if (isset($_POST['edit-topic-ok'])){
$name = txt($_POST['name']);
if (empty($name)) $err .= 'Не введёно имя темы.</br>';
if (!empty($message) && (strlen($message) < 2 || strlen($message) > 128)) $err .= 'Неверная длина имени.</br>';
if (!isset($err)){
mysql_query("UPDATE `forum-u` SET `name` = '".$name."' WHERE `id` = '".int($forum_u['id'])."'");
header('Location: /forum/topic-'.int($forum_u['id']).'.dll');
}}
error($err);
echo '<div class="main-href"><form method="post" action="topic-sett-'.int($forum_u['id']).'.dll?selest=name">';
echo 'Название темы:</br><input type="text" name="name" placeholder="Мах 128 символов" maxlength="128" value="'.$forum_u['name'].'"/></br>';
echo '<input type="submit" name="edit-topic-ok" title="Изменить" value="Изменить тему">';
echo '</form></div>';
}else{
header('Location: /forum/topic-'.int($forum_u['id']).'.dll');
}
break;
case 'act':
if ($apache['id']==$forum_u['id-apache']){
if ($forum_u['act']==0){
mysql_query("UPDATE `forum-u` SET `act` = '1' WHERE `id` = '".int($forum_u['id'])."'");
mysql_query("INSERT INTO `forum-m` SET `id-forum` = '".int($forum['id'])."', `id-forum-u` = '".int($forum_u['id'])."', `id-apache` = '".int($apache['id'])."', `message` = '[red]Закрыл тему.[/red]', `date` = '".time()."'");
header('Location: /forum/topic-'.int($forum_u['id']).'.dll');
}else{
mysql_query("UPDATE `forum-u` SET `act` = '0' WHERE `id` = '".int($forum_u['id'])."'");
mysql_query("INSERT INTO `forum-m` SET `id-forum` = '".int($forum['id'])."', `id-forum-u` = '".int($forum_u['id'])."', `id-apache` = '".int($apache['id'])."', `message` = '[green]Открыл тему.[/green]', `date` = '".time()."'");
header('Location: /forum/topic-'.int($forum_u['id']).'.dll');
}
}else if ($apache['level']>=2){
if ($forum_u['act']==0){
mysql_query("UPDATE `forum-u` SET `act` = '1' WHERE `id` = '".int($forum_u['id'])."'");
mysql_query("INSERT INTO `forum-m` SET `id-forum` = '".int($forum['id'])."', `id-forum-u` = '".int($forum_u['id'])."', `id-apache` = '".int($apache['id'])."', `message` = '[red]Закрыл тему.[/red]', `date` = '".time()."'");
header('Location: /forum/topic-'.int($forum_u['id']).'.dll');
}else{
mysql_query("UPDATE `forum-u` SET `act` = '0' WHERE `id` = '".int($forum_u['id'])."'");
mysql_query("INSERT INTO `forum-m` SET `id-forum` = '".int($forum['id'])."', `id-forum-u` = '".int($forum_u['id'])."', `id-apache` = '".int($apache['id'])."', `message` = '[green]Открыл тему.[/green]', `date` = '".time()."'");
header('Location: /forum/topic-'.int($forum_u['id']).'.dll');
}
}else{
header('Location: /forum/topic-'.int($forum_u['id']).'.dll');
}
break;
case 'delete':
if ($apache['id']==$forum_u['id-apache']){
if ($apache['level']>=2){
$forum_f_c = mysql_query("SELECT * FROM `forum-f` WHERE `id-forum-u` = '".int($forum_u['id'])."' ORDER BY `date` LIMIT 3");
while ($forum_f = mysql_fetch_assoc($forum_f_c)){
unlink('file/f'.int($forum_f['id']).'_'.$forum_f['file']);
}
mysql_query("DELETE FROM `forum-u` WHERE `id` = '".int($forum_u['id'])."'");
mysql_query("DELETE FROM `forum-m` WHERE `id-forum-u` = '".int($forum_u['id'])."'");
mysql_query("DELETE FROM `forum-f` WHERE `id-forum-u` = '".int($forum_u['id'])."'");
header('Location: /forum/forum-'.int($forum['id']).'.dll');
}else{
header('Location: /forum/topic-'.int($forum_u['id']).'.dll');
}
}else if ($apache['level']>=2){
$forum_f_c = mysql_query("SELECT * FROM `forum-f` WHERE `id-forum-u` = '".int($forum_u['id'])."' ORDER BY `date` LIMIT 3");
while ($forum_f = mysql_fetch_assoc($forum_f_c)){
unlink('file/f'.int($forum_f['id']).'_'.$forum_f['file']);
}
mysql_query("DELETE FROM `forum-u` WHERE `id` = '".int($forum_u['id'])."'");
mysql_query("DELETE FROM `forum-m` WHERE `id-forum-u` = '".int($forum_u['id'])."'");
mysql_query("DELETE FROM `forum-f` WHERE `id-forum-u` = '".int($forum_u['id'])."'");
header('Location: /forum/forum-'.int($forum['id']).'.dll');
}else{
header('Location: /forum/topic-'.int($forum_u['id']).'.dll');
}
break;
}
include_once('../apahe/bottom.php');
?>