Файл: public_html/light_moder.php
Строк: 907
<?
define('PROTECTOR', 1);
defined('index') or die('Error: restricted access');
$head = 'mod_panel';//фикс. места
$textl='Модер-панель';
@include_once('files/db.php');
@include_once('files/auth.php');
@include_once('include.php');
@include_once('files/vip.php');
@include_once('files/online.php');
@include_once('files/sql.php');
@include_once('files/lvl.php');
@include_once('files/func.php');
@include_once('files/regeneration.php');
prava(2);
    $url_admin="<a href='/index.php?$_get_r' $bt_s> В Модерку</a>";
    $adminka_inner="<h1 class='center'> Модерка: </h1>";
    $pricina = array(
        'Спам, КАПС',
        'Реклама',
        'Проблемы с никнеймом',
        'Оскорбление администрации',
        'Оскорбление игры',
        'Отказ в сотрудничестве',
        'Нецензурная лексика',
        'Завуалированый мат',
        'Распространение Вредоносных Ссылок',
        'Игнор предупреждения',
        'Мультовод',
        'Провоцирование ссоры в чате');
    $times_array = array(60,3600,86400,604800,2592000,31104000);
    $name_times = array('Минута','Час','День','Неделя','Месяц','Год');
    $block_array = array('Простой','Блокировка аккаунта');
    $zamena_array = array('-пропускать-','Заменить бан (искл. - блок)');
    
    if($udata['prava']<4){
        $limit_times = 3;
        $limit_block = 1;
        $limit_zamena = 1;
    } else {
        $limit_times = count($times_array);
        $limit_block = count($block_array);
        $limit_zamena = count($zamena_array);
    }
    
    if($udata['prava']==3){
        $limit_block = count($block_array);
        $limit_times = 4;
    }
    
    
    $_Option_Times = null;
    $_Option_Block = null;
    $_Option_Pricina = null;
    $_Option_Zamena = null;
    
    
    for($i=0; $i<count($pricina); $i++){
        $_Option_Pricina .="
        <br><input type='radio' name='pricina' value='$i'> ".$pricina[$i].""; 
    }
    
    for($i=0; $i<$limit_times; $i++){
        if($i==2){ $sel = 'selected';}
        else { $sel = null; }
        $_Option_Times .= "
        <br><option value='$i' $sel>".$name_times[$i]."</option>"; 
    }
    
    for($i=0; $i<$limit_block; $i++){
        $_Option_Block .= "
        <br><option value='$i'>".$block_array[$i]."</option>"; 
    }
    
    for($i=0; $i<$limit_block; $i++){
        $_Option_Zamena .= "
        <br><option value='$i'>".$zamena_array[$i]."</option>"; 
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
switch($_GET['mod']){
default:
@include_once('files/head.php'); 
@include_once('files/zag.php'); 
    $bans= @mysql_num_rows( @mysql_query_new("SELECT * FROM `ban` WHERE `ban_time`>'$time' and `status`='1'"));
echo"
$adminka_inner
$div
    <a href='/index.php?$_get_r&mod=ban' class='margin0 bttn_green'>Забанить </a>
    <a href='/index.php?$_get_r&mod=ip' class='margin0 bttn_sea'>Поиск по ip</a>
    <a href='/index.php?$_get_r&mod=banned' class='margin0 bttn_red'>Список забаненых (<b>$bans</b>)</a>";
if($udata['prava']>=3){
    echo"
    <a href='/index.php?$_get_r&mod=ban_in_search' class='margin0 bttn_red'>Массовый бан</a>";
}
echo"
</div>
$balka
$javabacksea";
break;
case 'ban':
$_User = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `users` WHERE `id`='$_GET[usr]'"));
$Ban_Num = @mysql_num_rows( @mysql_query_new("SELECT * FROM `ban` WHERE `usr`='$_GET[usr]' and `ban_time`>'".time()."' and `status`='1' LIMIT 1"));
    if($Ban_Num!=0){
        $ban_text_ok="<b> (<font color='red'>забанен</font>) </b>";
    } else {
        $ban_text_ok=null;
    }
    
    if(!empty($_GET['post'])){
        $koment = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `komentarai` WHERE `id`='$_GET[post]'"));
        $_komment = $koment['komentaras']; 
    } elseif(!empty($_GET['post_tiket'])) {
        $koment = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `tikets_message` WHERE `id`='$_GET[post_tiket]'"));
        $_komment = $koment['text'];
    }
    
    
if(empty($_POST)){
    @include_once('files/head.php'); 
    @include_once('files/zag.php');
    
    echo"
    <h1 class='center'>Бан</h1>
    $div
    <form  method='post'>
    Логин:
    <br>
    <input class='input' type='text' size='5' value='$_User[id]' name='id_usr' disabled>
    <input class='input' type='text' size='10' value='$_User[usr]' name='nick'>$ban_text_ok
    <br>Сообщение:
    <br><textarea name='sms' maxlength='5000' rows=5 cols=15 size='150' wrap='off'>$_komment</textarea>
    
    
    <b>Причина бана:</b>
    $_Option_Pricina
    <br> <input type='radio' name='pricina' value='dr_pricina' checked> <b>Другая причина:</b>
    <br> <input class='input' type='text' value='$_komment' size='25' name='dr_pricina' placeholder='Введите текст...'>
    <br>
    <br><i>Комментарий Администраторам</i>:
    <br><input class='input' type='text' size='25' name='inoe'>
    
    <br> Время бана:
    <br> <input class='input' type='tel' maxlength='2' maxnumber='50' value='1' name='time'>
    
    <br>Тип времени:
    <br> <select name='times'>
    $_Option_Times
    </select>
    
    <br>Тип бана:
    <br> <select name='block'>
    $_Option_Block
    </select>
    
    <br>Если аккаунт уже забанен:
    <br> <select name='zamena_bana'>
    $_Option_Zamena
    </select>
    
    
    <input class='bttn' type='submit' value='Забанить'>
    </form>
    </div>
    $url_admin";
} else {
    @include_once('files/head.php'); 
    @include_once('files/zag.php'); 
    
    $_User = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `users` WHERE `usr`='$_POST[nick]'"));
    $Ban_Sql = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `ban` WHERE `usr`='$_GET[usr]' and `ban_time`>'".time()."' and `status`='1' LIMIT 1"));
    $echo = null;
    $err = 0;
    
        if($_POST['pricina']=='dr_pricina'){
            $text_ban=$_POST['dr_pricina'];
        } else {
            $text_ban=$pricina["".$_POST['pricina'].""];
        }
    
    if(empty($_User['id'])){
        $err++;
        $echo.="<br> • Нет такого игрока!";
    } else {
        $echo.="<br> • Игрок: ".us("user{".$_User['id']."}")."";
    }
    if($_User['prava']>=4 or $_User['prava']>=1 and $udata['prava']<3){
        $err++;
        $echo.="<br> • Вы не имеете права банить этого игрока!";
    }
    
    if(empty($text_ban)){
        $err++;
        $echo.="<br> • Вы не указали причину бана!";
    }
    if($_POST['times']>=$limit_times){
        $err++;
        $echo.="<br> • Ваш максимальный тип времени: <b>".$name_times["".($limit_times-1).""]."</b>.";
    }
    if($_POST['block']>=$limit_block){
        $err++;
        $echo.="<br> • Максимальный тип бана: <b>".$block_array["".($limit_block-1).""]."</b>.";
    }
    if($_POST['zamena_bana']>=$limit_zamena){
        $err++;
        $echo.="<br>• При активном бане, максимум что Вы можете: <b>".$zamena_array["".($limit_zamena-1).""]."</b>.";
    }
    if($_POST['time']>30 or $_POST['time']<1){
        $err++;
        $echo.="<br> • Неверный срок! <i>(1-30)</i>";
    }
    if(!empty($Ban_Sql['id']) and $_POST['zamena_bana']==0){
        $err++;
        $echo.="<br> • Нельзя повторно банить! ";
    }
    if(!empty($Ban_Sql['id']) and $_POST['zamena_bana']==1 and $Ban_Sql['block']==1){
        $err++;
        $echo.="<br> •  Увы, у этого аккаунта - <font color='red'> блок</font>!! =( ";
    }
    
    
    if(empty($err)){
            
        $time_ban_post=(($_POST['time']*$_POST['times'])+time());
        if($_POST['zamena_bana']==1 and !empty($Ban_Sql['id'])){
            @mysql_query_new("UPDATE `ban`         
            SET `status`='0' 
            WHERE `usr`='$asd[id]'
            and `ban_time`>'$time'
            and `block`!='1'
            and `status`='1'");
            $echo.="<br> • Прошлый бан деактивирован!";
        }
        
        if($_POST['block']==1){
            $_banned="<u>заблокирован</u>";
        } else{
            $_banned="забанен";
        }
    
        $ntime = ($times_array["".$_POST['times'].""]*$_POST['time']);
        $block = $_POST['block'];
    
        $text_ban = preg_replace ("|<br>|","<br>",$text_ban);
        $_POST['sms'] = preg_replace ("|<br>|","<br>",$_POST['sms']);
    
        @mysql_query_new("
        INSERT INTO `ban` SET
        `usr` = '$_User[id]',
        `inoe` = '$_POST[inoe]',
        `sms` = '$_POST[sms]', 
        `text` = '$text_ban', 
        `admin` = '$udata[id]',
        `block`='$_POST[block]',
        `ban_time` = '".($time+$ntime)."', 
        `time`='$time', 
        `status`='1' ");
        $echo.="<br> • <b> Освободится</b> - через ".times2($ntime)."";
        $echo.="<br> <font color='green'><center><b> Успешно $_banned. </b></center></font>";
    } else {
        $echo.="<br> <font color='red'><center> К сожалению, игрок не забанен!
        <br>(".slv($err,'причина','причины','причин').")</center> </font>";
    }
echo"
    <h1 class='center'>Бан</h1>
    $balka
    $inner
    <b>Результат</b>:
    $echo
    <a href='/index.php?$_SERVER[QUERY_STRING]' class='bttn_green'>Вернуться</a>
    </div>
    $url_admin";
}
break;
case 'ban_in_search':
prava(3);
if(empty($_GET['search']) and empty($_POST['search'])){
    @include_once('files/head.php'); 
    @include_once('files/zag.php'); 
    echo"
    <h1 class='center' style='font-size: 14px; padding: 3px 3px;'> Бан по IP </h1>
    $div
    <form method='POST'>
    Поиск:
    <br> <input type='text' size='20' name='search'>
    <br> <input type='radio' name='type' value='ip' checked>По IP
    <br> <input type='radio' name='type' value='usr'>По никнейму
    <input class='bttn_green' type='submit' value='Найти'>
    </form>
    </div>
    $url_admin";
}
  
elseif(!empty($_POST['search'])){
    if($_POST['type']!='usr'){ $_POST['type']='ip'; }
    @header ("Location: /index.php?$_get_r$_get_mod&search=$_POST[search]&type=$_POST[type]");
    exit;    
} elseif(empty($_POST)){
    @include_once('files/head.php'); 
    @include_once('files/zag.php'); 
        if($_GET['type']!='usr'){
            $_GET['type']='ip';
            $type_text = 'Бан по IP';
            $_sql = "SELECT `id`,`usr`,`lvl`,`ip` FROM `users` WHERE `ip`='". $_GET['search'] ."' ";
        } else {
            $_GET['type']='usr';
            $type_text = 'Бан по никнейму';
            $_sql = "SELECT `id`,`usr`,`lvl`,`ip` FROM `users` WHERE `usr` LIKE '%". $_GET['search'] ."%' ";
        }
        if($_GET['page']<1){ $_GET['page'] = 1;}
        $num = abs(($_GET['page']-1) * 10);
        $a = $num;
        
    $req = @mysql_query_new($_sql." ORDER BY `lvl` DESC LIMIT $num,10");
    $avto = @mysql_num_rows(@mysql_query_new($_sql));
    echo"
    <h1 class='center' style='font-size: 14px; padding: 3px 3px;'> $type_text: $_GET[search] </h1>
    $div
    <center><b>Выдало</b>: <u>".slv($avto,'результат','результата','результатов').".</u></center>
    </div>
    $balka
    ";
    
    echo"
    <form method='post'>";
    while($asd = @mysql_fetch_array($req)){
        $Ban_Sql = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `ban` WHERE `usr`='$asd[id]' and `ban_time`>'$time' and `status`='1' LIMIT 1"));
        
        
        $a++;
        $b=floor($a/2)*2;
        if($a<=$num+10){ 
            $ch = 'checked';
        } else {
            $ch = null;
        }
    
        if($b==$a){
            $inner_content_ ="<div class='inner_content_raids_mod_key_1'>";
        } else {
            $inner_content_ ="<div class='inner_content_raids_mod_key_2'>";
        }
        
        if(empty($Ban_Sql['id'])){
            $banned = '-';
        } elseif($Ban_Sql['block']==1){
            $banned = '
            <font color="red"><b>Заблокирован</b></font>'.'
            <br> <b>Освободится</b>: '.times2($Ban_Sql['ban_time']-$time);
        } else {
            $banned = '
            <font color="red">+++</font>'.'
            <br> <b>Освободится</b>: '.times2($Ban_Sql['ban_time']-$time);
        }
        
        echo"
        $inner_content_
          <input type='checkbox' name='check_".($asd['id'])."' value='".($asd['id'])."' $ch>
          ".us("user{".$asd['id']."}")."
          <span class='rightw'>(<b>$asd[lvl]</b> ур.)</span>
          <br> <b>Бан</b>: $banned
        </div>
        ";
    }
    if($a==$num){
        echo "$inner<center><i>По заданым параметрам никто не найден. </i> </center>
        <a href='/index.php?$_get_r$_get_mod' class='bttn_green'>Искать снова</a></div>
        $url_admin";
        break;
    }
    
    
    if($avto>10){
        echo $balka;
        pager(10, $avto, "/index.php?$_get_r$_get_mod&search=$_GET[search]&type=$_GET[type]");
    }
    
    
echo"
    $balka
    $inner
    <form  method='post'>
    <b>Причина бана:</b>
    $_Option_Pricina
    <br> <input type='radio' name='pricina' value='dr_pricina' checked> <b>Другая причина:</b>
    <br> <input class='input' type='text' value='$_komment' size='25' name='dr_pricina' placeholder='Введите текст...'>
    <br>
    <br><i>Комментарий Администраторам</i>:
    <br><input class='input' type='text' size='25' name='inoe'>
    
    <br> Время бана:
    <br> <input class='input' type='number' maxlength='2' size='3'  value='1' name='time'>
    
    <br>Тип времени:
    <br> <select name='times'>
    $_Option_Times
    </select>
    
    <br>Тип бана:
    <br> <select name='block'>
    $_Option_Block
    </select>
    
    <br>Если аккаунт уже забанен:
    <br> <select name='zamena_bana'>
    $_Option_Zamena
    </select>
    
    
    <input class='bttn' type='submit' value='Забанить'>
    </form>
    </div>
    $url_admin";
} else {
    
    @include_once('files/head.php'); 
    @include_once('files/zag.php'); 
    
    $ok=0;
    $all=0;
    $_echo=null;
    
    if($_GET['type']!='usr'){
        $type_text = 'Бан по IP';
    } else {
        $type_text = 'Бан по никнейму';
    }
    
    foreach($_POST as $_ind => $_val){
        if(mb_substr($_ind, 0, 6)=='check_'){
            $_User = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `users` WHERE `id`='$_val' LIMIT 1"));
            $Ban_Sql = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `ban` WHERE `usr`='$_User[id]' and `ban_time`>'$time' and `status`='1' LIMIT 1"));
        
            $all++;
            $err = null;
            $echo = null;
    
                if($_POST['pricina']=='dr_pricina'){
                    $text_ban=$_POST['dr_pricina'];
                } else {
                    $text_ban=$pricina["".$_POST['pricina'].""];
                }
    
            if(empty($_User['id'])){
                $err++;
                $echo.="<br> • Нет такого игрока!";
            } else {
                $echo.="<br> • Игрок: ".us("user{".$_User['id']."}")."";
            }
            if($_User['prava']>=4 or $_User['prava']>=1 and $udata['prava']<3){
                $err++;
                $echo.="<br> • Вы не имеете права банить этого игрока!";
            }
            if(empty($text_ban)){
                $err++;
                $echo.="<br> • Вы не указали причину бана!";
            }
            if($_POST['times']>=$limit_times){
                $err++;
                $echo.="<br> • Ваш максимальный тип времени: <b>".$name_times["".($limit_times-1).""]."</b>.";
            }
            if($_POST['block']>=$limit_block){
                $err++;
                $echo.="<br> • Максимальный тип бана: <b>".$block_array["".($limit_block-1).""]."</b>.";
            }
            if($_POST['zamena_bana']>=$limit_zamena){
                $err++;
                $echo.="<br>• При активном бане, максимум что Вы можете: <b>".$zamena_array["".($limit_zamena-1).""]."</b>.";
            }
            if($_POST['time']>30 or $_POST['time']<1){
                $err++;
                $echo.="<br> • Неверный срок! <i>(1-30)</i>";
            }
            if(!empty($Ban_Sql['id']) and $_POST['zamena_bana']==0){
                $err++;
                $echo.="<br> • Нельзя повторно банить! ";
            }
            if(!empty($Ban_Sql['id']) and $_POST['zamena_bana']==1 and $Ban_Sql['block']==1){
                $err++;
                $echo.="<br> •  Увы, у этого аккаунта - <font color='red'> блок</font>!! =( ";
            }
    
    
            if(empty($err)){
                $ok++;
                $time_ban_post=(($_POST['time']*$_POST['times'])+time());
                if($_POST['zamena_bana']==1 and !empty($Ban_Sql['id'])){
                    @mysql_query_new("UPDATE `ban`         
                    SET `status`='0' 
                    WHERE `usr`='$_User[id]'
                    and `ban_time`>'$time'
                    and `block`!='1'
                    and `status`='1'");
                    $echo.="<br> • Прошлый бан деактивирован!";
                }
        
                if($_POST['block']==1){
                    $_banned="<u>заблокирован</u>";
                } else{
                    $_banned="забанен";
                }
    
                $ntime = ($times_array["".$_POST['times'].""]*$_POST['time']);
                $block = $_POST['block'];
                $text_ban = preg_replace ("|<br>|","<br>",$text_ban);
                $_POST['sms'] = preg_replace ("|<br>|","<br>",$_POST['sms']);
    
                @mysql_query_new("
                INSERT INTO `ban` SET
                `usr` = '$_User[id]',
                `inoe` = '$_POST[inoe]',
                `sms` = '$_POST[sms]', 
                `text` = '$text_ban', 
                `admin` = '$udata[id]',
                `block`='$_POST[block]',
                `ban_time` = '".($time+$ntime)."', 
                `time`='$time', 
                `status`='1' ");
                $echo.="<br> • <b> Освободится</b> - через ".times2($ntime)."";
                $echo.="<br> <font color='green'><center><b> Успешно $_banned. </b></center></font>";
            } else {
                $echo.="<br> <font color='red'><center> К сожалению, игрок не забанен!
                <br>(".slv($err,'причина','причины','причин').")</center> </font>";
            }
        
        $a++;
        $b=floor($a/2)*2;
        
        if($b==$a){
            $inner_content_ ="<div class='inner_content_raids_mod_key_1'>";
        } else {
            $inner_content_ ="<div class='inner_content_raids_mod_key_2'>";
        }
        
        $_echo.="
        $inner_content_ <span class='rightw'>(<b>$_User[lvl]</b> ур.)</span>
        <b>Результат</b>:
        $echo
        </div>
        ";
        }
    }
    
    if($all==0){
        $echo="
        $inner
        <center><i>Аккаунты не найдены</i></center>
        </div>
        ";
    }
    echo"
    <h1 class='center' style='font-size: 14px; padding: 3px 3px;'> $type_text: $_GET[search] </h1>
    $div
    <center><b>Готово</b>: <u> $ok / $all</u></center>
    </div>
    $balka
    $_echo
    <a href='/index.php?$_SERVER[QUERY_STRING]' class='bttn_green'>Вернуться</a>
    </div>
    $url_admin
    ";
}
break;
case 'banned':
@include_once('files/head.php'); 
@include_once('files/zag.php');
if($_GET['act']!='fast_final')
{$_get_panel_ = "
<div class='switcher_link left selected'>Последние</div>
<div class='switcher_link right'><a href='/index.php?$_get_r$_get_mod&act=fast_final'>Скоро выйдут</a></div>";
$_order = 'ORDER BY `id` DESC'; }else
{$_get_panel_ = "
<div class='switcher_link left'><a href='/index.php?$_get_r$_get_mod'>Последние</a></div>
<div class='switcher_link right selected'>Скоро выйдут</div>";
$_order = 'ORDER BY `ban_time` ASC';}
if ($_GET['page']<=1) {$_GET['page']=1;}
$num = obnul(($_GET['page']-1) * 10);
$a = $num;
$_echo = null;
$_sql = "SELECT * FROM `ban` WHERE `ban_time`>'". time() ."' and `status`='1'";
$avto= @mysql_num_rows( @mysql_query_new("$_sql"));
$req = @mysql_query_new("$_sql $_order LIMIT $num,10") or die( mysql_error() );
$_radius = "  style='border-radius:  0px 0px 6px 6px; padding: 7px;' ";
if($avto==0){echo"$adminka_inner
$div
<center><i>Нет забаненых!</i> </center></div>
$url_admin"; break;}
echo"$adminka_inner
$balka
$_get_panel_
$inner
Найдено банов - ($avto)
</div>
$balka
";
While($asd = @mysql_fetch_array($req)){
    $a++;
    $b=(floor($a/2)*2); 
if(!empty($asd['block'])){$inner_content_ ="<div class='baloon-inner-red' $_radius>";}
elseif($b==$a)
{$inner_content_ ="<div class='inner_content_clans_mod_list_1' $_radius>";}else
{$inner_content_ ="<div class='inner_content_clans_mod_list_2' $_radius>";}
    $_echo .="
    <div style='padding: 3px 0px 3px 0px;'>
    <div class='boss_title'>$a. <b> ".us("user{".$asd['usr']."}")."</b> 
    ";
    
    if($udata['prava']>=4){
    $_echo .="n <a href='/index.php?r=moderator&mod=delete_ban&id=$asd[id]$_get_go' title='Удалить бан' class='rightw'>$imgno</a> "; }
    if($udata['prava']>=3 and ($asd['ban_time']>$time)){
    $_echo .= "n <a href='/index.php?r=moderator&mod=no_ban&id=$asd[id]$_get_go$_get_user' title='Разбанить' class='rightw'>[разбанить]</a> ";}
    if($udata['prava']>=5){
    $_echo .= "n <a href='/index.php?r=moderator&mod=red_ban&id=$asd[id]$_get_go$_get_user' title='Разбанить' class='rightw'>[red]</a> ";}
    $_echo.="n </div> $inner_content_ ";
    
    if(!empty($asd['text'])){    $_echo .="n<b>Причина:</b> <span class='rightw'>(<i>на ".sekund(($asd['ban_time']-$asd['time']))."</i>) </span>
        <br><textarea disabled>$asd[text]</textarea><br>";}
    if(!empty($asd['sms'])){    $_echo .="n<b>Вещь-Док:</b> <br><textarea disabled>$asd[sms]</textarea><br>"; }
    if(!empty($asd['inoe'])){    $_echo .="n<b>Примечание модератора:</b> <br><input value='$asd[inoe]' disabled><br>"; }
    if($asd['ban_time']>$time){$_echo .="n$imgtime <b>Окончание:</b> <u>".sek_nazad($asd['ban_time'],99999)."</u><br>"; }
    $_echo .="n<b>Мд:</b> ".us("user{".$asd['admin']."}")." <span class='rightw'>(<i>".date("d.m.y",$asd['time'])."</i>) </span>"; 
    $_echo .="</div> </div>";
}
/////////////////////
echo"
$_echo 
";
pager(10, $avto, "/index.php?$_get_r$_get_mod$_get_act");
echo"$url_admin";
/////////////////////
break;
case 'red_ban':
prava(5);
$req = @mysql_query_new("SELECT * FROM `ban` WHERE `id`='$_GET[id]'");
$ban_moder = @mysql_fetch_array($req);
$New_Ban = null;
if(empty($ban_moder['id'])){
    $_SESSION['msg']="$baloon <center> Бан не найден.</div>"; }
elseif(!empty($_POST)){
    foreach($_POST as $_ind => $_val) {
        if($ban_moder[$_ind]!=$_val) $New_Ban .= "<br> [$_ind]: $ban_moder[$_ind] => $_val";
        @mysql_query_new("UPDATE `ban` SET `$_ind`='$_val' WHERE `id`='$_GET[id]' LIMIT 1");
    }
    
    if($New_Ban) {
        $New_Ban = "<center> Бан игрока user{".$ban_moder['usr']."} - успешно отредактирован!</center>".$New_Ban;
        @mysql_query_new("INSERT INTO `tmp` SET `usr`='$ban_moder[usr]', `admin`='$udata[id]', `log`='$New_Ban', `read`='1', `time` = '$time'");
    }
    $_SESSION['msg']="$baloon <center> Бан успешно отредактирован!</div>";
    @header ("Location: /index.php?$_get_r$_get_mod$_get_id$_get_user"); exit;
    }
elseif(empty($_POST)){
    
@include_once('files/head.php'); 
@include_once('files/zag.php');
$time_array = array(
-(3600*24*365*3),
-(3600*24*365),
-(3600*24*180),
-(3600*24*90),
-(3600*24*60),
-(3600*24*30)
-(3600*24*14),
-(3600*24*7),
-(3600*24*3),
-(3600*24*1),
0,
(3600*24*1),
(3600*24*3),
(3600*24*7),
(3600*24*14),
(3600*24*30),
(3600*24*60),
(3600*24*90),
(3600*24*180),
(3600*24*365),
(3600*24*365*3)
);
  $array_status = array('Неактивный','Активный');
  $array_block = array('Простой','Блокировка Аккаунта');
echo"
<h1 class='center'>Редактируем бан</h1>
$div
    <div class='row'>
    <form method='post'>
    <b>Игрок</b>: <br>
    <input type='text' name='usr' value='".us("usr{".$ban_moder['usr']."}")."' disabled> <br>
    <input type='text' name='usr' value='$ban_moder[usr]'> <br>
    
    <b>Админ</b>: <br>
    <input type='text' name='admin' value='".us("usr{".$ban_moder['admin']."}")."' disabled> <br>
    <input type='text' name='admin' value='$ban_moder[admin]'> <br>
    
    <b>Причина</b>: <br>
    <textarea name='text'>$ban_moder[text]</textarea><br>
    
    <b>Вещь.док</b>: <br>
    <textarea name='sms'>$ban_moder[sms]</textarea><br>
    
    <b>Комментарий Администраторам</b>: <br>
    <textarea name='inoe'>$ban_moder[inoe]</textarea><br>
    
    
    
  <b>Время бана</b>:<br>
  <select name='ban_time'>
  ";
    for($i=0; $i<count($time_array); $i++){
        $tim = $time_array[$i];
        $_new_time=($ban_moder['ban_time']+$tim);
        if($tim==0){
            $_select = " selected";
        }else{
            $_select = null;
        }
    
        if($_new_time>$time){
            echo"
            <option value='$_new_time' $_select>".sek_nazad($_new_time,900)."</option> ";
        }
    }
echo"
    </select><br>";
    
    
    
echo"
  <b>Статус</b>:<br>
  <select name='status'>
  ";
    for($i=0; $i<count($array_status); $i++){
        
        if($ban_moder['status']==$i){
            $_select = " selected";
        }else{
            $_select = null;
        }
        
        echo"
        <option value='$i' $_select>".$array_status[$i]."</option> ";
    }
echo"
    </select><br>";
    
    
    
    
echo"
  <b>Тип бана</b>:<br>
  <select name='block'>
  ";
    for($i=0; $i<count($array_block); $i++){
        
        if($ban_moder['block']==$i){
            $_select = " selected";
        }else{
            $_select = null;
        }
        echo"
        <option value='$i' $_select>".$array_block[$i]."</option> ";
    }
echo"
    </select><br>
    
    <input class='margin0 bttn' type='submit' value='Сохранить'>
    </form>
</div>
</div>
$url_admin"; 
break;
}
if(!empty($usdata['id'])){
    @header ("Location: /index.php?r=profile&mod=ban_list$_get_user"); exit; } else {
    @header ("Location: /index.php?$_get_r&mod=banned"); exit; }
break;
case 'no_ban':
prava(3);
$req =  @mysql_query_new("SELECT * FROM `ban` WHERE `id`='$_GET[id]'");
$ban_moder =  @mysql_fetch_array($req);
if(empty($ban_moder['id'])){
    $_SESSION['msg']="$baloon <center> Бан не найден.</div>";
    if(!empty($usdata['id'])){
    @header ("Location: /index.php?r=profile&mod=ban_list$_get_user"); exit;} else{ 
    @header ("Location: /index.php?$_get_r&mod=banned"); exit;}
    }
elseif($ban_moder['ban_time']<$time){
    $_SESSION['msg']="$baloon <center> Игрок ".us("us_url{".$ban_moder['usr']."}")." - не забанен!</div>";
        
    if(!empty($usdata['id'])){
    @header ("Location: /index.php?r=profile&mod=ban_list$_get_user"); exit;} else{ 
    @header ("Location: /index.php?$_get_r&mod=banned"); exit;}
    }
elseif(!empty($_POST['yes'])){
    if($ban_moder['status']==1)
    {$_ban_num=0; $_ban_word='разбанен';}else
    {$_ban_num=1; $_ban_word='забанен';}
    
    $New_Log = "<center> Игрок user{".$ban_moder['usr']."} - успешно $_ban_word!</center>";
    if($_ban_word) @mysql_query_new("INSERT INTO `tmp` SET `usr`='$ban_moder[usr]', `admin`='$udata[id]', `log`='$New_Log', `read`='1', `time` = '$time'");
    @mysql_query_new("UPDATE `ban` SET `status`='$_ban_num' WHERE `id`='$ban_moder[id]'");
    $_SESSION['msg']="$baloon <center> Игрок ".us("us_url{".$ban_moder['usr']."}")." - успешно $_ban_word!</center></div>";
    
    if(!empty($usdata['id'])){
    @header ("Location: /index.php?r=profile&mod=ban_list$_get_user"); exit;} else{ 
    @header ("Location: /index.php?$_get_r&mod=banned"); exit;}
    }
elseif(empty($_POST['yes'])){
@include_once('files/head.php'); 
@include_once('files/zag.php');
    if($ban_moder['status']==1)
    {$_ban_word='разбанить';}else
    {$_ban_word='забанить';}
echo"
$adminka_inner
 $baloon
    Уверенны что хотите $_ban_word игрока - ".us("us_url{".$ban_moder['usr']."}")." ???
    <form method='post'>
    <input class='margin0 bttn' type='submit' name='yes' value='Уверен!'/></form>
    <a href='/index.php?$_get_r&mod=banned' $bt_r> Нет, я передумал!</a>
  </div>
$url_admin";}
break;
case 'delete_ban':
prava(4);
$req = @mysql_query_new("SELECT * FROM `ban` WHERE `id`='$_GET[id]'");
$ban_moder = @mysql_fetch_array($req);
if(empty($ban_moder['id'])){
    $_SESSION['msg']="$baloon <center> Бан не найден.</div>";
    
    if(!empty($usdata['id'])){
    @header ("Location: /index.php?r=profile&mod=ban_list$_get_user"); exit;} else{ 
    @header ("Location: /index.php?$_get_r&mod=banned"); exit;}
    }
elseif(!empty($_POST['yes'])){
    $_SESSION['msg']="$baloon <center> Бан №$_GET[id] - успешно удален!</div>";
    @mysql_query_new("DELETE FROM `ban` WHERE `id`='$_GET[id]'") or die(baloon('Error'));
    
    if(!empty($usdata['id'])){
    @header ("Location: /index.php?r=profile&mod=ban_list$_get_user"); exit;} else{ 
    @header ("Location: /index.php?$_get_r&mod=banned"); exit;}
    }
elseif(empty($_POST['yes'])){
@include_once('files/head.php'); 
@include_once('files/zag.php');
echo"
$adminka_inner
 $baloon
   Уверенны что хотите удалить Бан <b>№$_GET[id] </b>, от игрока - ".us("us_url{".$ban_moder['usr']."}")." ???
   <form  method='post'>
   <input class='margin0 bttn' type='submit' name='yes' value='Уверен!'/></form>
   <a href='/index.php?$_get_r&mod=banned' $bt_r> Нет, я передумал!</a>
 </div>
$url_admin";}
break;
case 'ip':
@include_once('files/head.php'); 
@include_once('files/zag.php'); 
if(empty($_POST['ip']) and empty($_GET['ip'])){
echo"
$adminka_inner
$div
    <form action='?$_get_r&mod=ip' method='POST'>
    Введите ip:<br><input class='input' type='text' value='$_GET[ip]' size='20' name='ip'/><br>
    <input class='button' type='submit' value='Найти'>
    </form>
</div>
$url_admin";
}else{
    
if(!empty($_POST['ip'])){ $_GET['ip'] = $_POST['ip']; }
    $req = @mysql_query_new("SELECT `id`,`usr` FROM `users` WHERE `ip`='$_GET[ip]'");
    $avto= @mysql_num_rows($req);
    $i=0;
    $_echo=null;
    
While($usdata = @mysql_fetch_array($req)){
    $i++;
    $a++; $b=floor($a/2)*2;
    if($b==$a)
    {$inner_content_raids_mod_key ="<div class='inner_content_raids_mod_key_1'>";}else
    {$inner_content_raids_mod_key ="<div class='inner_content_raids_mod_key_2'>";}
$Num_Ban = @mysql_num_rows( @mysql_query_new("SELECT * FROM `ban` WHERE `usr`='$usdata[id]' and `ban_time`>'".time()."' and `status`='1' LIMIT 1"));
if($Num_Ban==1){$ban_text_ok="<b> (<font color='red'>забанен</font>) </b>";}else{$ban_text_ok=null;}
$_echo.="
$inner_content_raids_mod_key 
  $i. ".us("user{".$usdata['id']."}")." 
  $ban_text_ok
  <a href='?$_get_r&mod=ban&usr=$usdata[id]' class='rightw cc'>[ban]</a>
</div>n";
}
if($i==0){ $_echo = "$inner<center> <i>Ничего не найдено.</i> </center></div>"; }
echo"
$adminka_inner
$div
<b>$_GET[ip]</b> <a class='rightw' href='?$_get_r&mod=ban_in_search&type=ip&search=$_GET[ip]'>$imglock</a>
</br>(Всего аккаунтов с таким ip - <b>$avto</b>)</div>
$balka
$_echo
</div>
$url_admin";
}
break;
}
@include_once('files/down.php');
?>