Вход Регистрация
Файл: adm_panel/platforms.php
Строк: 299
<?php
define
('NTOP'1);
$title 'Админка - Управление площадками';
require_once(
'../system/connect.php');
require_once(
'../system/core.php');
require_once(
'../system/function.php');
require_once(
'../m/head.php');
reg();
level(2);
switch(
$act)
    {
        default:
        echo 
'<div class="title2">Управление площадками</div>';

                 
                
$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++;
                                
//////////////////////// Вывод Отзовов
                                
$sait_com mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait_comments` WHERE `id_sait` = '".$row['id']."'"));
                                
/////////////////////////////////////// Конец ))))
                                
                                
$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"><span class="o">'.$start.'</span> <img src="http://www.google.com/s2/favicons?domain='.$row['url'].'"/> <a href="http://'.$set['home'].'/out/'.$row['id'].'">'.$row['name'].'</a> ['.$row['hosts'].'/'.$row['hits'].'] <a href="http://'.$set['home'].'/stats/'.$row['id'].'"><img src="/img/index/s.gif" alt="?"></a> | 
                                <a href="http://'
.$set['home'].'/adm_panel/platforms.php?act=com_sait&id='.$row['id'].'">Отзовы</a> ['.$sait_com.']</div>';
                                echo 
'<div class="topni">';
                                if(
mb_strlen($row['about']) > 50)
                                    {
                                        
$text substr($row['about'],0,50);
                                        echo 
''.$text.'...<br/>'
                                    }
                                else
                                    {
                                        echo 
''.$row['about'].'<br/>'
                                    }
                                echo 
'<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> | '.$ban.'<br/>';
                                echo 
'</div>';
                            }
                        
navigation($count,$page_sait,$page,'http://'.$set['home'].'/adm_panel/platforms.php/',$total);
                    }
                else
                    {
                        echo 
'<div class="main">';
                        echo 
'Площадок нет! <br/>';
                        echo 
'</div>';
                    }
            
        break;


///////////////////////////////////////////////////// Управление Коментариями к сайту

        
        
case 'com_sait':    
                if(isset(
$_POST['ok']))
                            {
                                
$name = isset($user_data) ? $user_data['login'] : 'Гость';
                                
$comment filter($_POST['comment']);
                                
$test mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait_comments` WHERE `name` = '".$name."' AND `text` = '".$comment."' AND `time` > '".(time()-500)."' AND `id_sait` = '".$id."'"));
                                if(
$test == 0)
                                    {
                                        
$error '';
                                        if(empty(
$comment))
                                            {
                                                
$error .= 'Нет отзыва<br/>';
                                            }
                                        if(
$user_data)
                                            {
                                                if(
$user_data['antiflud'] + $set['antiflud_time'] > time())
                                                    {
                                                        
$error .= 'Вы писали сообщение меньше чем '.$set['antiflud_time'].' секунд назад! <br/>';
                                                    }
                                            }
                                        else
                                            {
                                                if(
$set['guest_antiflud'] + $set['antiflud_time'] > time())
                                                    {
                                                        
$error .= 'Вы писали сообщение меньше чем '.$set['antiflud_time'].' секунд назад! <br/>';
                                                    }                                    
                                            }
                                        if(
mb_strlen($comment) > 100)
                                            {
                                                
$error .= 'Отзыв содержит больше 100 символов<br/>';
                                            }
                                        if(!empty(
$error))
                                            {
                                                echo 
'<div class="topni">';
                                                echo 
$error;
                                                echo 
'</div>';
                                            }
                                        else
                                            {

                                                
$comment mysql_query("INSERT INTO `".$prefix."sait_comments` SET `name` = '".$name."', `text` = '".$comment."', `time` = '".time()."', `id_sait` = '".$id."'");
                                                if(
$user_data)
                                                    {
                                                        
$update_antiflud mysql_query("UPDATE `".$prefix."users` SET `antiflud` = '".time()."' WHERE `id` = '".$user_data['id']."'");
                                                    }
                                                else
                                                    {
                                                        
$update_antiflud_guest mysql_query("UPDATE `".$prefix."settings` SET `value` = '".time()."' WHERE `name` = 'guest_antiflud'");
                                                    }
                                                if(
$comment)
                                                    {
                                                        echo 
'<div class="main">';
                                                        echo 
'Отзыв добавлен!<br/>';
                                                        echo 
'</div>';
                                                    }
                                                else
                                                    {
                                                        echo 
'<div class="topni">';
                                                        echo 
'Отзыв не добавлен!<br/>';
                                                        echo 
'</div>';
                                                    }
                                            }
                                    }    
                            }
                        echo 
'<div class="title2">Отзыва к сайту</div>';
                        
$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="topni"><span class="o">'.$start.'</span> <b>'.$row['name'].'</b> ['.data($row['time']).']</div>';
                                        echo 
'<div class="main">';
                                        echo 
$row['text'].'<br/>';
                                        echo 
'</div>';
                                        echo 
'<div class="topni"><a href="http://'.$set['home'].'/adm_panel/platforms.php?act=del_com&id='.$row['id'].'">Удалить</a></div>';
                                    }
                                    echo 
'<div class="main"><center>[<a href="http://'.$set['home'].'/adm_panel/platforms.php?act=del_comm&id='.$id.'">Удалить все отзовы</a>]</center></div>';
                                    
                                
navigation($count,$page_sait_comments,$page,'http://'.$set['home'].'/adm_panel/platforms/com/'.$id.'/',$total);
                            }
                        else
                            {
                                echo 
'<div class="main">';
                                echo 
'Отзывов к данному сайту нет!<br/>';
                                echo 
'</div>';
                            }
                        if(!
$user_data)
                        {
                         echo 
'<div class="main"><b>Отзывы разрешено оставлять только пользователям топ рейтинга !!!!</b></div>';
                        }
                         else
                        {
                        echo 
'<div class="title2">Добавления отзыва</div>';
                        echo 
'<div class="main">';
                        echo 
'
                        <form action="/adm_panel/platforms.php?act=com_sait&id='
.$id.'" method="post">
                        Комментарий [max. 100]:<br/>
                        <textarea name="comment" cols="38" rows="8"></textarea><br/>
                        '
;

                        echo 
'<input name="ok" type="submit" value="Добавить" />
                        </form>
                        </div>'
;
                        }
        break;
    
//////////////////////////////////////////////////////

        
/////////////////////////////////////////////////////        
        
        
        
        
case 'del_com':
        echo 
'<div class="title2">Управление комментариями</div>';
        
$del mysql_query("DELETE FROM `".$prefix."sait_comments` WHERE `id` = '".$id."'");
            if(
$del)
                {
                    echo 
'<div class="main">';
                    echo 
'Комментарий успешно удален<br/>';
                    echo 
'</div>';
                }
            else
                {
                    echo 
'<div class="topni">';
                    echo 
'Комментарий не удален<br/>';
                    echo 
'</div>';
                }
        break;
        
        
////////////////////////////////////////////////////////    


////////////////////////////////////////////////
case 'del_comm':
        echo 
'<div class="title2">Управление комментариями</div>';
        
$del mysql_query("DELETE FROM `".$prefix."sait_comments` WHERE `id_sait` = '".$id."'");
        if(
$del)
            {
                echo 
'<div class="main">';
                echo 
'Комментарии успешно удалены<br/>';
                echo 
'</div>';
            }
        else
            {
                echo 
'<div class="error">';
                echo 
'Комментарии не удалены<br/>';
                echo 
'</div>';
            }
        break;
//////////////////////////////////////////////////        
        



    
        
    
        
case 'edit_sait':
        echo 
'<div class="title2">Изменение площадки</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'");
        
$image_biger mysql_query("SELECT * FROM `".$prefix."images` WHERE `type` = 'biger'");
        
$image_one mysql_query("SELECT * FROM `".$prefix."images` WHERE `type` = 'one'");
        
        if(
$platform_count 0)
            {
                if(!isset(
$_POST['ok']))
                    {
                        echo 
'<div class="main">';
                        echo 
'
                        <form action="platforms.php?act=edit_sait&id='
.$id.'" method="post">
                        Название сайта(max. 35):<br/>
                        <input type="text"  class="input" name="name" maxlength="35" value="'
.$user_platform['name'].'" /><br/>
                        URL сайта(без http:// и т.п)(max. 35):<br/>
                        <input type="text"  class="input" name="url" maxlength="35" value="'
.$user_platform['url'].'" /><br/>
                        Описание сайта(max. 100):<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 `position` 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/>';
                        

                        echo 
'<small><strong>Для главной страницы сайта: <font size=2>*</font></strong></small><br/>';
                        while(
$count_big mysql_fetch_array($image_big))
                            {
                        
$checked = ($user_platform['imagebig'] == $count_big['name']) ? ' checked="checked"' '';
                        echo 
'<input type="radio" name="imagebig" value="'.$count_big['name'].'"'.$checked.'>';
                        echo 
'<img src="http://'.$set['home'].'/images/big/'.$count_big['name'].'.gif" alt=""><br/>';
                            }
                            while(
$count_biger mysql_fetch_array($image_biger))
                            {
                            
$checked = ($user_platform['imagebig'] == $count_biger['name']) ? ' checked="checked"' '';
                            echo 
'<input type="radio" name="imagebig" value="'.$count_biger['name'].'"'.$checked.'>';
                            echo 
'<img src="http://'.$set['home'].'/images/big/'.$count_biger['name'].'.gif" alt=""><br/>';
                            }

                            echo 
'<hr/>';
                            echo 
'<small><strong>Для остальных страниц сайта: <font size=2>*</font></strong></small><br/>';
                            while(
$count_small mysql_fetch_array($image_small))
                            {
                                
$checked = ($user_platform['imagesm'] == $count_small['name']) ? ' checked="checked"' '';
                                echo 
'<input type="radio" name="imagesm" value="'.$count_small['name'].'"'.$checked.'>';
                                echo 
'<img src="http://'.$set['home'].'/images/mini/'.$count_small['name'].'.gif" alt=""><br/>';
                            }
                            
                            echo 
'<hr>';
                            echo 
'<small><strong>Онлайн: <font size=2>*</font></strong></small><br/>';
                            while(
$count_one mysql_fetch_array($image_one))
                            {
                                
$checked = ($user_platform['imageone'] == $count_one['name']) ? ' checked="checked"' '';
                                echo 
'<input type="radio" name="imageone" value="'.$count_one['name'].'"'.$checked.'>';
                                echo 
'<img src="http://'.$set['home'].'/images/on/'.$count_one['name'].'.gif" alt=""><br/>';
                            }
                        
                        
                        echo 
'</br><input name="ok" type="submit" value="Изменить" />
                        </form>
                        </div>'
;
                    }
                else
                    {
                        
$name htmlspecialchars(trim($_POST['name']));
                        
$url htmlspecialchars(trim($_POST['url']));
                        
$about htmlspecialchars(trim($_POST['about']));
                        
$cat intval($_POST['cat']);
                        
$imagebig htmlspecialchars(trim($_POST['imagebig']));
                        
$imagesm htmlspecialchars(trim($_POST['imagesm']));
                        
$imageone htmlspecialchars(trim($_POST['imageone']));                        
                        
$error '';
                        if(empty(
$cat) OR empty($imagebig) OR empty($imagesm) OR empty($imageone) OR empty($name) OR empty($url) OR empty($about))
                            {
                                
$error .= 'Ошибка! Не заполнены поля!<br/>';
                            }
                        if(
mb_strlen($name) > 100)
                            {
                                
$error .= 'Ошибка! Поле "Название сайта" содержит больше 35 символов! <br/>';
                            }
                        if(
mb_strlen($url) > 100)
                            {
                                
$error .= 'Ошибка! Поле "URL сайта" содержит больше 35 символов! <br/>';
                            }
                        if(
mb_strlen($about) > 200)
                            {
                                
$error .= 'Ошибка! Поле "Описание сайта" содержит больше 35 символов! <br/>';
                            }
                        if(!empty(
$error))
                            {
                                echo 
'<div class="topni">';
                                echo 
$error;
                                echo 
'</div>';
                            }
                        else
                            {
                    
$edit mysql_query("UPDATE `".$prefix."sait` SET 
                     `category` = '"
.$cat."',
                     `imagebig` = '" 
mysql_real_escape_string($imagebig) . "',
                     `imagesm` = '" 
mysql_real_escape_string($imagesm) . "',
                     `imageone` = '" 
mysql_real_escape_string($imageone) . "',             
                     `name` = '" 
mysql_real_escape_string($name) . "',
                     `about` = '" 
mysql_real_escape_string($about) . "',
                     `url` = '" 
mysql_real_escape_string($url) . "' 
                     WHERE `id` = '" 
.$id"'");
                                if(
$edit)
                                    {
                                        echo 
'<div class="main">';
                                        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="title2">Удаление сайта <strong>'.$sait['name'].'</strong></div>';
                if(!isset(
$_GET['ok']))
                    {
                        echo 
'<div class="main">';
                        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="main">';
                                echo 
'Сайт успешно удален!<br/>';
                                echo 
'</div>';
                            }
                        else
                            {
                                echo 
'<div class="error">';
                                echo 
'В процессе удаления произошла ошибка!<br/>';
                                echo 
'</div>';
                            }
                    }
            }
        else
            {
                echo 
'<div class="error">';
                echo 
'Нет такой площадки!<br/>';
                echo 
'</div>';
            }
        break;
        
        case 
'ban':
            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="main">
                                                <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 htmlspecialchars(trim($_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` = '" 
mysql_real_escape_string($reason) . "', 
               `ban_who` = '" 
mysql_real_escape_string($user_data['login']) . "' 
                WHERE `id` = '" 
.$id"'");
                                                        if(
$ban)
                                                            {
                                    echo 
'<div class="main">Сайт успешно забанен! <br/></div>';
                                                            }
                                                        else
                                                            {
                                    echo 
'<div class="error">Сайт не забанен !<br/></div>';
                                                            }
                                                    }
                                            }
                                    }
                                    else
                                    {
            
$unban mysql_query("UPDATE `".$prefix."sait` SET 
                `ban` = '0', 
                `ban_reason` = '', 
                `ban_who` = '' 
                WHERE `id` = '" 
.$id"'");
                                        if(
$unban)
                                            {
                                                echo 
'<div class="main">';
                                                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">';
echo 
'<a href="http://'.$set['home'].'/adm_panel/platforms.php">К управлению площадками</a><br/>';
echo 
'<a href="http://'.$set['home'].'/adm_panel/index.php">В Админку</a></div>';

require_once(
'../m/foot.php');
?>
Онлайн: 0
Реклама