<?
include '../config.php';
include '../func.php';
head();
aut();
ban();
$theme = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_themes` WHERE `id` = '".num($_GET['theme'])."'"));

if (empty($theme['id'])) {
    
    echo link2 . 'Данной темы не существует' . div;
    pod_navig();
    foot();
    exit();
}

if ( $_GET['mod'] == 1 AND ( $theme['user'] == $id_session OR $level_forum_session >= 1 OR $level_session >= 2 ) ) {
    
    $result = mysql_query("UPDATE `forum_themes` SET `status` = '0' WHERE `id` = '".$theme['id']."'");
    if ( $result != NULL ) header('Location: theme.php?razdel='.$theme['razdel_id'].'&pod_forum='.$theme['pod_forum'].'&theme='.$theme['id'].'&mod=otkr_yes');
    else header('Location: theme.php?razdel='.$theme['razdel_id'].'&pod_forum='.$theme['pod_forum'].'&theme='.$theme['id'].'&mod=otkr_error');
}

if ( $_GET['mod'] == 2 AND ( $theme['user'] == $id_session OR $level_forum_session >= 1 OR $level_session >= 2 ) ) {
    
    $result = mysql_query("UPDATE `forum_themes` SET `status` = '1' WHERE `id` = '".$theme['id']."'");
    if ( $result != NULL ) header('Location: theme.php?razdel='.$theme['razdel_id'].'&pod_forum='.$theme['pod_forum'].'&theme='.$theme['id'].'&mod=zakr_yes');
    else header('Location: theme.php?razdel='.$theme['razdel_id'].'&pod_forum='.$theme['pod_forum'].'&theme='.$theme['id'].'&mod=zakr_error');
}

if ( ($_GET['mod'] != 2 AND $_GET['mod'] != 1) ) {
    
    $result = mysql_query("UPDATE `forum_themes` SET `status` = '1' WHERE `id` = '".$theme['id']."'");
    if ( $result != NULL ) header('Location: theme.php?razdel='.$theme['razdel_id'].'&pod_forum='.$theme['pod_forum'].'&theme='.$theme['id'].'&mod=zakr_yes');
    else header('Location: theme.php?razdel='.$theme['razdel_id'].'&pod_forum='.$theme['pod_forum'].'&theme='.$theme['id'].'&mod=zakr_error');
}

pod_navig();
foot();
?>