View file modules/admin/list.asp

File size: 8.84Kb
<?php
/**
 * @author ByUNNAMED
 * @copyright 2012
 */
ob_start();
$title='Админ Панель';//Титул
include('../../system/include/settings.inc');//Потключаемся к базе	
include('../../system/include/function.inc');//Выводим функции
head($title,$udata2);//Верх страницы
if(isset($udata['pass']) && isset($udata2['nick'])){
if($udata2['prava'] == 1)
{
    switch($_GET['mod'])
        {
    default:

    echo '<a href="../../modules/admin/list.asp?mod=ban_chat">Забаненые</a><br />';
    echo '<a href="../../modules/admin/list.asp?mod=ban_pers">Заблокированые персонажи</a><br />';
    echo '<a href="../../modules/admin/list.asp?mod=ban_akk">Заблокированые акаунты</a><br />';

    
    
    break;
    case 'ban_chat':
    $at_page=6;
    $page = (int)$_GET['page'];
    $s=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `ban_chat`"),0);
    $total = intval(($s - 1) / $at_page) + 1;
    $page = (int)$page;
    if(empty($page) or $page < 0) $page = 1;
    if($page > $total) $page = $total;
    $from = $page * $at_page - $at_page;
    $req = mysql_query("SELECT * FROM `ban_chat` ORDER BY `id` DESC LIMIT ".$from.",".$at_page."");
                    $kol = mysql_num_rows($req);
        if($kol > 0)
            {
                while($ban = mysql_fetch_array($req))
                    {
                        
                        echo 'Ник: '.$ban['usr'].'<br />Причина: '.$ban['text'].'<br />Время: ';
                    $ban[ban_time]=$ban[ban_time]-time();
                    if($ban[ban_time]<60){
                    echo "$ban[ban_time] сек.";
                    }elseif($ban[ban_time]>60 and $ban[ban_time]<3600){
                    $ban[ban_time]=round($ban[ban_time]/60);
                    echo "$ban[ban_time] мин.";
                    }else{
                    $ban[ban_time]=round($ban[ban_time]/3600);
                    echo "$ban[ban_time] часов";
                    }
                    echo '<br /><a href="?mod=del_bchat&amp;id='.$ban['id'].'">Разбанить</a><br />';
                    }
                if($at_page > 0)
                        {
    if($s > $onpage) echo '';

	if ($page >= 4) $go1 = '<a href= ?page=1>1</a> ... ';
		if ($page != $total and $page != $total-1) $outpage = ' ... <a href= ?page=' .$total. '>'.$total.'</a>';
		if($page - 2 > 0) $page2left = ' <a href= ?page='. ($page - 2) .'>'. ($page - 2) .'</a> ';
		if($page - 1 > 0) $page1left = '<a href= ?page='. ($page - 1) .'>'. ($page - 1) .'</a> ';
		if($page + 2 <= $total) $page2right = ' <a href= ?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
		if($page + 1 <= $total) $page1right = ' <a href= ?page='. ($page + 1) .'&>'. ($page + 1) .'</a>';
		if($s > $onpage) echo 'Страницы: ('.$go1.''.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.''.$outpage.')<br/>';
                        }
                
            }else{
                echo 'Нет забаненых.<br />';
            }
    echo '<a href="index.asp?">Назад</a>';
    break;
    case 'ban_pers':
    
     $at_page=6;
    $page = (int)$_GET['page'];
    $s=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `ban_pers`"),0);
    $total = intval(($s - 1) / $at_page) + 1;
    $page = (int)$page;
    if(empty($page) or $page < 0) $page = 1;
    if($page > $total) $page = $total;
    $from = $page * $at_page - $at_page;
    $req = mysql_query("SELECT * FROM `ban_pers` ORDER BY `id` DESC LIMIT ".$from.",".$at_page."");
                    $kol = mysql_num_rows($req);
        if($kol > 0)
            {
                while($ban = mysql_fetch_array($req))
                    {
                        
                        echo 'Ник: '.$ban['usr'].'<br />Причина: '.$ban['text'].'<br />Время: ';
                    $ban[ban_time]=$ban[ban_time]-time();
                    if($ban[ban_time]<60){
                    echo "$ban[ban_time] сек.";
                    }elseif($ban[ban_time]>60 and $ban[ban_time]<3600){
                    $ban[ban_time]=round($ban[ban_time]/60);
                    echo "$ban[ban_time] мин.";
                    }else{
                    $ban[ban_time]=round($ban[ban_time]/3600);
                    echo "$ban[ban_time] часов";
                    }
                    echo '<br /><a href="?mod=del_bpers&amp;id='.$ban['id'].'">Разблокировать</a><br />';
                    }
                if($from > 0)
                        {
    if($s > $onpage) echo '';

	if ($page >= 4) $go1 = '<a href= ?page=1>1</a> ... ';
		if ($page != $total and $page != $total-1) $outpage = ' ... <a href= ?page=' .$total. '>'.$total.'</a>';
		if($page - 2 > 0) $page2left = ' <a href= ?page='. ($page - 2) .'>'. ($page - 2) .'</a> ';
		if($page - 1 > 0) $page1left = '<a href= ?page='. ($page - 1) .'>'. ($page - 1) .'</a> ';
		if($page + 2 <= $total) $page2right = ' <a href= ?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
		if($page + 1 <= $total) $page1right = ' <a href= ?page='. ($page + 1) .'&>'. ($page + 1) .'</a>';
		if($s > $onpage) echo 'Страницы: ('.$go1.''.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.''.$outpage.')<br/>';
                        }
                
            }else{
                echo 'Нет заблокированых.<br />';
            }
            echo '<a href="index.asp?">Назад</a>';
    break;
    case 'ban_akk':
    
    $at_page=6;
    $page = (int)$_GET['page'];
    $s=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `ban_akk`"),0);
    $total = intval(($s - 1) / $at_page) + 1;
    $page = (int)$page;
    if(empty($page) or $page < 0) $page = 1;
    if($page > $total) $page = $total;
    $from = $page * $at_page - $at_page;
    $req = mysql_query("SELECT * FROM `ban_akk` ORDER BY `id` DESC LIMIT ".$from.",".$at_page."");
                    $kol = mysql_num_rows($req);
        if($kol > 0)
            {
                while($ban = mysql_fetch_array($req))
                    {
                        
                        echo 'Ник: '.$ban['usr'].'<br />Причина: '.$ban['text'].'<br />Время: ';
                    $ban[ban_time]=$ban[ban_time]-time();
                    if($ban[ban_time]<60){
                    echo "$ban[ban_time] сек.";
                    }elseif($ban[ban_time]>60 and $ban[ban_time]<3600){
                    $ban[ban_time]=round($ban[ban_time]/60);
                    echo "$ban[ban_time] мин.";
                    }else{
                    $ban[ban_time]=round($ban[ban_time]/3600);
                    echo "$ban[ban_time] часов";
                    }
                    echo '<br /><a href="?mod=del_bakk&amp;id='.$ban['id'].'">Разблокировать</a><br />';
                    }
                if($from > 0)
                        {
    if($s > $onpage) echo '';

	if ($page >= 4) $go1 = '<a href= ?page=1>1</a> ... ';
		if ($page != $total and $page != $total-1) $outpage = ' ... <a href= ?page=' .$total. '>'.$total.'</a>';
		if($page - 2 > 0) $page2left = ' <a href= ?page='. ($page - 2) .'>'. ($page - 2) .'</a> ';
		if($page - 1 > 0) $page1left = '<a href= ?page='. ($page - 1) .'>'. ($page - 1) .'</a> ';
		if($page + 2 <= $total) $page2right = ' <a href= ?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
		if($page + 1 <= $total) $page1right = ' <a href= ?page='. ($page + 1) .'&>'. ($page + 1) .'</a>';
		if($s > $onpage) echo 'Страницы: ('.$go1.''.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.''.$outpage.')<br/>';
                        }
                
            }else{
                echo 'Нет заблокированых.<br />';
            }
            echo '<a href="index.asp?">Назад</a>';
    
    break;
    case 'del_bchat':
    $id=abs(intval($_GET['id'])); 
    mysql_query("DELETE FROM `ban_chat` WHERE `id` = '$id'");
    echo 'Персонаж успешно розбанен!<br /><a href="index.asp?">Назад</a>';
    
    break;
    case 'del_bpers':
    $id=abs(intval($_GET['id'])); 
    mysql_query("DELETE FROM `ban_pesr` WHERE `id` = '$id'");
    echo 'Персонаж успешно разблокирован!<br /><a href="index.asp?">Назад</a>';
    
    break;
    case 'del_bakk':
    $id=abs(intval($_GET['id'])); 
    mysql_query("DELETE FROM `ban_akk` WHERE `id` = '$id'");
    echo 'Акаунт успешно разблокирован!<br /><a href="index.asp?">Назад</a>';
    
    break;
    
    }
}else{
    echo 'Вы не администратор!';
    foot();     exit;
}
}else{echo'Вы не ';
echo '<a href="../../index.asp">авторизированы</a> или не выбран персонаж';
}

foot();     	
?>