Вход Регистрация
Файл: imstat.ru/adm_panel/platforms.php
Строк: 204
<?php
define
('NTOP'1);
$title 'Управление площадками';
require_once(
'../system/connect.php');
require_once(
'../system/core.php');
require_once(
'../system/function.php');
require_once(
'../str/head.php');
reg();
level(2);
switch(
$act)
    {
        default:
        echo 
'<div class="topik">Управление площадками</div>';
        echo 
'<div class="rek"><a href="http://'.$set['home'].'/adm_panel/platforms.php?act=view"><strong>Просмотреть все площадки</strong></a></div>
        <div class="stat"><form action="platforms.php?act=view" method="POST">
        Текст поиска (max.50):<br />
        <input type="text" name="text" maxlength="50" /><br />
        Искать по:<br />
        <select name="type">
        <option value="id">ID</option>
        <option value="url">URL</option>
        <option value="name">Названию</option>
        <option value="about">Описанию</option>
        </select><br />
        Сортировать по:<br />
        <select name="sort">
        <option value="id">ID</option>
        <option value="hosts">Хостам</option>
        <option value="hits">Хитам</option>
        </select><br />
        <input name="search" type="submit" class="go" value="Искать" />
        </form></div>'
;
        break;
        case 
'view':
                echo 
'<div class="title">Управление площадками</div>';
        if(isset(
$_POST['search']))
            {
                
$text filter($_POST['text']);
                
$order filter($_POST['type']);
                
$sort filter($_POST['sort']);
                
$error '';
                if(empty(
$text) OR empty($order) OR empty($sort))
                    {
                        
$error .= 'Ошибка! Не заполнены поля! <br/>';
                    }
                if(
mb_strlen($text) > 50)
                    {
                        
$error .= 'Ошибка! Поле "Текст поиска" больше 50 символов! <br/>';
                    }
                if(!empty(
$error))
                    {
                        echo 
'<div class="error">';
                        echo 
$error;
                        echo 
'</div>';
                    }
                else
                    {
                        
$count mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `".$order."` LIKE '%".$text."%'"));
                        if(
$count 0)
                            {
                                
$total=intval(($count-1)/$page_sait)+1
                                
$page=abs(intval($_GET['page'])); 
                                if(empty(
$page) OR $page 0)
                                    {
                                        
$page 1
                                    }
                                if(
$page $total)
                                    {
                                        
$page $total
                                    }
                                
$past=intval($count/$page_sait);  
                                
$start=$page*$page_sait-$page_sait
                                
$saits mysql_query("SELECT * FROM `".$prefix."sait` WHERE `".$order."` LIKE '%".$text."%' ORDER BY `".$sort."` DESC LIMIT ".$start.",".$page_sait."");
                                while(
$row mysql_fetch_array($saits)) 
                                    {
                                        
$start++;
                                        
$ban = ($row['ban'] == 0) ? '<a href = "http://'.$set['home'].'/adm_panel/platforms.php?act=ban&id='.$row['id'].'">Блокировать</a>' '<a href = "http://'.$set['home'].'/adm_panel/platforms.php?act=ban&id='.$row['id'].'">Разблокировать</a>';
                                        echo 
'<div class="topni">'.$start.'. <a href="http://'.$set['home'].'/out.php?id='.$row['id'].'">'.$row['url'].'</a> <small>('.$row['hosts'].'/'.$row['hits'].') <a href="http://'.$set['home'].'/str/infos.php?id='.$row['id'].'"> (i)</small></a><br/>'.$row['about'].'<br/>&bull; <a href="http://'.$set['home'].'/adm_panel/platforms.php?act=edit_sait&id='.$row['id'].'">Изменить</a> | <a href="http://'.$set['home'].'/adm_panel/platforms.php?act=del_sait&id='.$row['id'].'">Удалить сайт</a> | <a href="http://'.$set['home'].'/adm_panel/platforms.php?act=comments&id='.$row['id'].'">Комментарии</a> | '.$ban.'</div>';
                                    }
                                
navigation($count,$page_sait,$page,'http://'.$set['home'].'/adm_panel/platforms.php?act=view&',$total);
                            }
                        else
                            {
                                echo 
'<div class="error">';
                                echo 
'По вашему запросу ничего не найдено!<br/>';
                                echo 
'</div>';
                            }
                    }
            }
        else
            {
                
$count mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait`"));
                if(
$count 0)
                    {
                        
$total=intval(($count-1)/$page_sait)+1
                        
$page=abs(intval($_GET['page'])); 
                        if(empty(
$page) OR $page 0)
                            {
                                
$page 1
                            }
                        if(
$page $total)
                            {
                                
$page $total
                            }
                        
$past=intval($count/$page_sait);  
                        
$start=$page*$page_sait-$page_sait
                        
$saits mysql_query("SELECT * FROM `".$prefix."sait` ORDER BY `hosts` DESC LIMIT ".$start.",".$page_sait."");
                        while(
$row mysql_fetch_array($saits)) 
                            {
                                
$start++;
                                
$ban = ($row['ban'] == 0) ? '<a href = "http://'.$set['home'].'/adm_panel/platforms.php?act=ban&id='.$row['id'].'">Блокировать</a>' '<a href = "http://'.$set['home'].'/adm_panel/platforms.php?act=ban&id='.$row['id'].'">Разблокировать</a>';
                                echo 
'<div class="topni">'.$start.'. <a href="http://'.$set['home'].'/out.php?id='.$row['id'].'">'.$row['url'].'</a> <small>('.$row['hosts'].'/'.$row['hits'].') <a href="http://'.$set['home'].'/str/infos.php?id='.$row['id'].'"> (i)</small></a><br/>'.$row['about'].'<br/>&bull; <a href="http://'.$set['home'].'/adm_panel/platforms.php?act=edit_sait&id='.$row['id'].'">Изменить</a> | <a href="http://'.$set['home'].'/adm_panel/platforms.php?act=del_sait&id='.$row['id'].'">Удалить сайт</a> | <a href="http://'.$set['home'].'/adm_panel/platforms.php?act=comments&id='.$row['id'].'">Комментарии</a> | '.$ban.'</div>';
                            }
                        
navigation($count,$page_sait,$page,'/adm_panel/platforms.php?act=view&',$total);
                    }
                else
                    {
                        echo 
'<div class="stat">';
                        echo 
'Площадок нет! <br/>';
                        echo 
'</div>';
                    }
            }
        break;
        case 
'edit_sait':
        echo 
'<div class="title">Изменение площадки</div>';
        
$platform mysql_query("SELECT * FROM `".$prefix."sait` WHERE `id` = '".$id."' LIMIT 1");
        
$platform_count mysql_num_rows($platform);
        
$user_platform mysql_fetch_array($platform);
        
$image_big mysql_query("SELECT * FROM `".$prefix."images` WHERE `type` = 'big'");
        
$image_small mysql_query("SELECT * FROM `".$prefix."images` WHERE `type` = 'small'");
        if(
$platform_count 0)
            {
                if(!isset(
$_POST['ok']))
                    {
                        echo 
'<div class="stat">';
                        echo 
'
                        <form action="platforms.php?act=edit_sait&id='
.$id.'" method="post">
                        URL сайта(без http:// и т.п)(max. 35):<br/>
                        <input type="text"  class="input" name="url" maxlength="35" value="'
.$user_platform['url'].'" /><br/>
                        Описание сайта(max. 150):<br/>
                        <textarea name="about" cols="38" rows="8">'
.$user_platform['about'].'</textarea><br/>
                        Категория:<br/>
                        <select name="cat">
                        '
;
                        
$cats mysql_query("SELECT * FROM `".$prefix."cat` ORDER BY `id` ASC");
                        if(
mysql_num_rows($cats) > 0)
                            {
                                while(
$cat mysql_fetch_assoc($cats))
                                    {
                                        
$selected = ($user_platform['category'] == $cat['id']) ? ' selected="selected"' '';
                                        echo 
'<option value="'.$cat['id'].'"'.$selected.'>'.$cat['name'].'</option>';
                                    }
                            }
echo 
'</select><br/><br/><input name="ok" type="submit" value="Изменить" /></form></div>';
                    }
                else
                    {
                        
$url filter($_POST['url']);
                        
$about filter($_POST['about']);
                        
$cat intval($_POST['cat']);
                        
$error '';
                        if(empty(
$cat) OR empty($url) OR empty($about))
                            {
                                
$error .= 'Ошибка! Не заполнены поля!<br/>';
                            }
                        if(
mb_strlen($url) > 35)
                            {
                                
$error .= 'Ошибка! Поле "URL сайта" содержит больше 35 символов! <br/>';
                            }
                        if(
mb_strlen($about) > 150)
                            {
                                
$error .= 'Ошибка! Поле "Описание сайта" содержит больше 150 символов! <br/>';
                            }
                        if(!empty(
$error))
                            {
                                echo 
'<div class="error">';
                                echo 
$error;
                                echo 
'</div>';
                            }
                        else
                            {
                                
$edit mysql_query("UPDATE `".$prefix."sait` SET `category` = '".$cat."', `image` = '".$image."', `about` = '".$about."', `url` = '".$url."' WHERE `id` = '".$id."'");
                                if(
$edit)
                                    {
                                        echo 
'<div class="stat">';
                                        echo 
'Сайт успешно отредактирован!<br/>';
                                        echo 
'</div>';
                                    }
                                else
                                    {
                                        echo 
'<div class="error">';
                                        echo 
'Сайт не отредактирован , попробуйте снова!<br/>';
                                        echo 
'</div>';
                                    }
                            }
                    }
            }
        else
            {
                echo 
'<div class="error">';
                echo 
'Данного сайта не существует!<br/>';
                echo 
'</div>';
            }
        break;
        case 
'del_sait':
        
$sait_isset mysql_query("SELECT * FROM `".$prefix."sait` WHERE `id` = '".$id."'LIMIT 1");
        
$sait_isset_c mysql_num_rows($sait_isset);
        if(
$sait_isset_c 0)
            {
                
$sait mysql_fetch_array($sait_isset );
                echo 
'<div class="title">Удаление сайта <strong>'.$sait['name'].'</strong></div>';
                if(!isset(
$_GET['ok']))
                    {
                        echo 
'<div class="stat">';
                        echo 
'Вы действительно хотите удалить сайт <strong>'.$sait['name'].'</strong> из Топ-Рейтинга ?<br/>';
                        echo 
'<a href="http://'.$set['home'].'/adm_panel/platforms.php?act=del_sait&id='.$id.'&ok">Да</a> | <a href="http://'.$set['home'].'/adm_panel/index.php">Нет</a><br/>';
                        echo 
'</div>';
                    }
                else
                    {
                        
$del_hosts mysql_query("DELETE FROM `".$prefix."hosts` WHERE `id_sait` = '".$id."'");
                        
$del_hits mysql_query("DELETE FROM `".$prefix."hits` WHERE `id_sait` = '".$id."'");
                        
$del_online mysql_query("DELETE FROM `".$prefix."sait_online` WHERE `id_sait` = '".$id."'");
                        
$del_reputation mysql_query("DELETE FROM `".$prefix."reputation` WHERE `id_sait` = '".$id."'");
                        
$del_sait_comments mysql_query("DELETE FROM `".$prefix."sait_comments` WHERE `id_sait` = '".$id."'");
                        
$del_platform mysql_query("DELETE FROM `".$prefix."sait` WHERE `id` = '".$id."'");
                        if(
$del_hosts AND $del_hits AND $del_online AND $del_platform AND $del_reputation AND $del_sait_comments)
                            {
                                echo 
'<div class="stat">';
                                echo 
'Сайт успешно удален!<br/>';
                                echo 
'</div>';
                            }
                        else
                            {
                                echo 
'<div class="error">';
                                echo 
'В процессе удаления произошла ошибка!<br/>';
                                echo 
'</div>';
                            }
                    }
            }
        else
            {
                echo 
'<div class="error">';
                echo 
'Нет такой площадки!<br/>';
                echo 
'</div>';
            }
        break;
        case 
'comments':
        echo 
'<div class="title">Управление комментариями</div>';
        
$isset_sait mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `id` = '".$id."'"));
        if(
$isset_sait 0)
            {
                
$count mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait_comments` WHERE `id_sait` = '".$id."'"));
                if(
$count 0)
                    {
                        
$total=intval(($count-1)/$page_sait_comments)+1
                        
$page=abs(intval($_GET['page'])); 
                        if(empty(
$page) OR $page 0)
                            {
                                
$page 1
                            }
                        if(
$page $total)
                            {
                                
$page $total
                            }
                        
$past=intval($count/$page_sait_comments);  
                        
$start=$page*$page_sait_comments-$page_sait_comments
                        
$comments mysql_query("SELECT * FROM `".$prefix."sait_comments` WHERE `id_sait` = '".$id."' ORDER BY `time` DESC LIMIT ".$start.",".$page_sait_comments."");
                        while(
$row mysql_fetch_array($comments)) 
                            {
                                
$start++;
                                echo 
'<div class="title2">'.$start.'.<strong>'.$row['name'].' ('.data($row['time']).')</strong><br/>';
echo 
$row['text'].'<br/>';
                                echo 
'&bull; <a href="http://'.$set['home'].'/adm_panel/platforms.php?act=del_comment&id='.$row['id'].'">Удалить</a><br/>';
                                echo 
'</div>';
                            }
                        echo 
'<div class="main">';
                        echo 
'<a href="http://'.$set['home'].'/adm_panel/platforms.php?act=del_comments&id='.$id.'">Удалить Все Комментарии</a><br/>';
                        echo 
'</div>';
                        
navigation($count,$page_sait_comments,$page,'http://'.$set['home'].'/adm_panel/platforms.php?act=comments&id='.$id.'&',$total);
                    }
                else
                    {
                        echo 
'<div class="stat">';
                        echo 
'Комментариев к данному сайту нет!<br/>';
                        echo 
'</div>';
                    }
            }
        else
            {
                echo 
'<div class="error">';
                echo 
'Нет такого сайта!</br>';
                echo 
'</div>';
            }
        break;
        case 
'del_comment':
        echo 
'<div class="title">Управление комментариями</div>';
        
$del mysql_query("DELETE FROM `".$prefix."sait_comments` WHERE `id` = '".$id."'");
        if(
$del)
            {
                echo 
'<div class="stat">';
                echo 
'Комментарий успешно удален<br/>';
                echo 
'</div>';
            }
        else
            {
                echo 
'<div class="error">';
                echo 
'Комментарий не удален<br/>';
                echo 
'</div>';
            }
        break;
        case 
'del_comments':
        echo 
'<div class="title">Управление комментариями</div>';
        
$del mysql_query("DELETE FROM `".$prefix."sait_comments` WHERE `id_sait` = '".$id."'");
        if(
$del)
            {
                echo 
'<div class="stat">';
                echo 
'Комментарии успешно удалены<br/>';
                echo 
'</div>';
            }
        else
            {
                echo 
'<div class="error">';
                echo 
'Комментарии не удалены<br/>';
                echo 
'</div>';
            }
        break;
        case 
'ban':
echo 
'<div class="title">Блокировка сайта</div>';
            if(
$id)
                {
                    
$checking mysql_query("SELECT * FROM `".$prefix."sait` WHERE `id` = '".$id."'");
                        if(
mysql_num_rows($checking) > 0)
                            {
                                
$check mysql_fetch_array($checking);
                                if(
$check['ban'] == 0)
                                    {
                                        if(!isset(
$_POST['ok']))
                                            {
                                                echo 
'
                                                <div class="stat">
                                                <form action="platforms.php?act=ban&id='
.$id.'" method="post">
                                                Причина бана(max.50):<br/>
                                                <input type="text" name="reason" maxlength="30" value=""/><br/>
                                                <input type="submit" name="ok" value="Забанить"/>
                                                </form></div>'
;
                                            }
                                        else
                                            {
                                                
$reason filter($_POST['reason']);
                                                
$error '';
                                                if(empty(
$reason))
                                                    {
                                                        
$error .= 'Ошибка! Не заполнено поле !<br/>';
                                                    }
                                                if(
mb_strlen($reason) > 50)
                                                    {
                                                        
$error .= 'Ошибка! Поле "Причина" содержит больше 50 символов!<br/>';
                                                    }
                                                if(!empty(
$error))
                                                    {
                                                        echo 
'<div class="error">';
                                                        echo 
$error;
                                                        echo 
'</div>';                                                        
                                                    }
                                                else
                                                    {
                                                        
$ban mysql_query("UPDATE `".$prefix."sait` SET `ban` = '1', `ban_reason` = '".$reason."', `ban_who` = '".$user_data['login']."' WHERE `id` = '".$id."'");
                                                        if(
$ban)
                                                            {
                                                                echo 
'<div class="stat">';
                                                                echo 
'Сайт успешно забанен! <br/>';
                                                                echo 
'</div>';
                                                            }
                                                        else
                                                            {
                                                                echo 
'<div class="error">';
                                                                echo 
'Сайт не забанен !<br/>';
                                                                echo 
'</div>';
                                                            }
                                                    }
                                            }
                                    }
                                    else
                                    {
                                        
$unban mysql_query("UPDATE `".$prefix."sait` SET `ban` = '0', `ban_reason` = '', `ban_who` = '' WHERE `id` = '".$id."'");
                                        if(
$unban)
                                            {
                                                echo 
'<div class="stat">';
                                                echo 
'Сайт успешно разбанен! <br/>';
                                                echo 
'</div>';
                                            }
                                        else
                                            {
                                                echo 
'<div class="error">';
                                                echo 
'Сайт не разбанен !<br/>';
                                                echo 
'</div>';
                                            }
                                    }
                            }
                        else
                            {
                                echo 
'<div class="error">';
                                echo 
'Ошибка! Данного сайта нет в базе !<br/>';
                                echo 
'</div>';
                            }
                }
        break;
    }
echo 
'<div class="main"><a href="http://'.$set['home'].'/adm_panel/index.php">В Админку</a></div>';
require_once(
'../str/foot.php');
?>
Онлайн: 1
Реклама