Вход Регистрация
Файл: New_top/AdmPanel/reklama.php
Строк: 172
<?php
$title 
'Панель управления сайтом - Управление Рекламой';
require_once(
'../Sys/head.php');
reg();
level(2);
switch(
$act)
    {
        default:
echo 
'<div class="block">Управление рекламой</div>';
echo 
'<div class="l1"><b>Ссылки верху</b></div>';        
        
$cat $mysqli->query("SELECT `id`,`name`,`link`,`color`,`stat` FROM `".$prefix."rekl` WHERE `stat` = '1'");
        if(
$cat->num_rows 0)
            {
                while(
$row $cat->fetch_assoc())
                    {
                        echo 
'<div class="li">- <a href="http://'.$row['link'].'"><font color=#'.$row['color'].'><small>'.$row['name'].'</small></font></a> <small>| </small>
                        <a href="http://'
.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/delete/'.$row['id'].'"><small>Удал</small></a>/<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/edit/'.$row['id'].'"><small>Ред</small></a>                
                        </div>'
;
                    }
            }
        else
            {
                echo 
'<div class="li">Нет активных ссылок !!!</div>';
            }
    echo 
'<div class="l1"><b>Партнеры</b></div>';            
            
$cat $mysqli->query("SELECT `id`,`name`,`link`,`color`,`stat` FROM `".$prefix."rekl` WHERE `stat` = '2'");
        if(
$cat->num_rows 0)
            {
                while(
$row $cat->fetch_assoc())
                    {
                        echo 
'<div class="li">- <a href="http://'.$row['link'].'"><font color=#'.$row['color'].'><small>'.$row['name'].'</small></font></a> <small>| </small>
                        <a href="http://'
.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/delete/'.$row['id'].'"><small>Удал</small></a>/<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/edit/'.$row['id'].'"><small>Ред</small></a>                
                        </div>'
;
                    }
            }
        else
            {
                echo 
'<div class="li">Нет активных ссылок !!!</div>';
            }
    echo 
'<div class="l1"><b>Вход/Статистика</b></div>';    
        
$cat $mysqli->query("SELECT `id`,`name`,`link`,`color`,`stat` FROM `".$prefix."rekl` WHERE `stat` = '3'");
        if(
$cat->num_rows 0)
            {
                while(
$row $cat->fetch_assoc())
                    {
                        echo 
'<div class="li">- <a href="http://'.$row['link'].'"><font color=#'.$row['color'].'><small>'.$row['name'].'</small></font></a> <small>| </small>
                        <a href="http://'
.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/delete/'.$row['id'].'"><small>Удал</small></a>/<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/edit/'.$row['id'].'"><small>Ред</small></a>                
                        </div>'
;
                    }
            }
        else
            {
                echo 
'<div class="li">Нет активных ссылок !!!</div>';
            }
    echo 
'<div class="l1"><b>iFrame Ссылки</b></div>';        
            
$cat $mysqli->query("SELECT `id`,`link` FROM `".$prefix."rekl` WHERE `stat` = '4'");
        if(
$cat->num_rows 0)
            {
                while(
$row $cat->fetch_assoc())
                    {
                        echo 
'<div class="li">- <small>'.$row['link'].'</small></font></a> <small>| </small>
                        <a href="http://'
.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/delete/'.$row['id'].'"><small>Удал</small></a>/<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/editf/'.$row['id'].'"><small>Ред</small></a>                
                        </div>'
;
                    }
            }
        else
            {
                echo 
'<div class="li">Нет активных ссылок !!!</div>';
            }

    
    echo
'<div class="poloska"><a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/if"><font color=#000000>Добавить ссылку</font></a></div>';        
            
        break;
        
////////////////////
    
        
case 'delete':
        if(
$id)
            {
        
$mysqli->query("DELETE FROM `".$prefix."rekl` WHERE `id` = '".$id."'");
                echo 
'<div class="l1">';
                echo 
'Ссылка успешно удалена.<br/>';
                echo 
'</div>';
            }
        else
            {
                echo 
'<div class="l1">';
                echo 
'Не выбрана новость.<br/>';
                echo 
'</div>';
            }
        break;
        
    
////////////////////////////////////    
        
        
        
case 'add':
        echo 
'<div class="block">Добавление ссылки</div>';
        if(!isset(
$_POST['ok']))
            {
                echo 
'
                <div class="l1">
                <form action="" method="post">
                Имя ссылка [max.50]:<br/>
                <input type="text" class="form" name="name" maxlength="50" value=""/><br/>
                Ссылка [max.30]:<br/>
                <input type="text" class="form" name="link" maxlength="30" value=""/><br/>
                Цвет [max.6]:<br/>
                <input type="text" class="form" name="color" maxlength="6" value="000000"/><br/>
                Место [max.2]:<br/>'
;
                echo 
'<select name="stat">';
                  echo 
'<option value="1">Верх</option><br/>';
                  echo 
'<option value="2">Партнеры</option><br/>';
                  echo 
'<option value="3">Вход/Статистика</option><br/>';
                echo 
'</select><br/>';
                echo 
'<input type="submit" class="button" name="ok" value="Добавить"/>
                </form></div>'
;
            }
        else
            {
                
$name filter($_POST['name']);
                
$link filter($_POST['link']);
                
$stat abs(intval($_POST['stat']));
                
$color filter($_POST['color']);
                
$error '';
                if(empty(
$name) OR empty($link) OR empty($stat) OR empty($color))
                    {
                        
$error .= 'Не заполнены поля.<br/>';
                    }
                if(
mb_strlen($name) > 50)
                    {
                        
$error .= 'Поле "Имя категории" больше 50 символов.<br/>';
                    }
                if(
mb_strlen($link) > 30)
                    {
                        
$error .= 'Поле "Ссылка" больше 30 символов.<br/>';
                    }                        
                if(
mb_strlen($stat) > 3)
                    {
                        
$error .= 'Поле "Место" больше 3 символов.<br/>';
                    }
                if(
mb_strlen($color) > 6)
                    {
                        
$error .= 'Поле "Цвет" больше 6 символов.<br/>';
                    }    
                if(!empty(
$error))
                    {
                        echo 
'<div class="error">';
                        echo 
'В результате заполнения полей , выявились ошибки:<br/>';
                        echo 
$error;
                        echo 
'<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/add">Повторить<a/><br/>';
                        echo 
'</div>';    
                    }
                else
                    {
                        
$mysqli->query("INSERT INTO `".$prefix."rekl` VALUES ('', '".$name."', '".$stat."', '".$link."', '".$color."')");
                        echo 
'<div class="l1">';
                        echo 
'Ссылка успешно добавлена.<br/>';
                        echo 
'</div>';
                    }
            }
        break;
//////////////        
    
case 'addf':
        echo 
'<div class="block">Добавление ссылки </div>';
        if(!isset(
$_POST['ok']))
            {
                echo 
'
                <div class="l1">
                <form action="" method="post">
                Ссылка [max.30]:<br/>
                <input type="text" class="form" name="link" maxlength="30" value=""/><br/>
                <input type="submit" class="button" name="ok" value="Добавить"/>
                </form></div>'
;
            }
        else
            {
                
$link filter($_POST['link']);
                
$error '';
                if(empty(
$link))
                    {
                        
$error .= 'Не заполнены поля.<br/>';
                    }
                if(
mb_strlen($link) > 30)
                    {
                        
$error .= 'Поле "Ссылка" больше 30 символов.<br/>';
                    }                        
                if(!empty(
$error))
                    {
                        echo 
'<div class="error">';
                        echo 
'В результате заполнения полей , выявились ошибки:<br/>';
                        echo 
$error;
                        echo 
'<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/addf">Повторить<a/><br/>';
                        echo 
'</div>';    
                    }
                else
                    {
                        
$mysqli->query("INSERT INTO `".$prefix."rekl` VALUES ('', '', '4', '".$link."', '')");
                        echo 
'<div class="l1">';
                        echo 
'Ссылка успешно добавлена.<br/>';
                        echo 
'</div>';
                    }
            }
        break;    
        
        case 
'if':
        
        echo 
'<div class="block">Добавление Ссылки</div>';
        echo 
'<div class="l1">';
        echo 
'<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/addf">Добавить обманую Ссылку</a><br/>';
        echo 
'<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/add">Добавить Ссылку</a>';
        echo 
'</div>';
        break;
        
//////////////////////////////////    
        
case 'editf':
        if(
$id)
            {
                
$isset $mysqli->query("SELECT * FROM `".$prefix."rekl` WHERE `id` = '".$id."'");
                if(
$isset->num_rows 0)
                    {
                        
$cat $isset->fetch_assoc();
                        echo 
'<div class="block">Изменение ссылки</div>';
                        if(!isset(
$_POST['ok']))
                            {
                                echo 
'
                                <div class="l1">
                                <form action="" method="post">
                                Ссылка [max.30]:<br/>
                                <input type="text" class="form" name="link" maxlength="30" value="'
.$cat['link'].'"/><br/>';
                                echo 
'<input type="submit" class="button" name="ok" value="Изменить"/>
                                </form></div>'
;
                            }
                        else
                            {
                                
$link filter($_POST['link']);
                                
$error '';
                                if(empty(
$link))
                                    {
                                        
$error .= 'Не заполнены поля.<br/>';
                                    }
                                if(
mb_strlen($link) > 30)
                                    {
                                        
$error .= 'Поле "Ссылки" больше 30 символов.<br/>';
                                    }
                                if(!empty(
$error))
                                    {
                                        echo 
'<div class="l1">';
                                        echo 
'В результате заполнения полей , выявились ошибки:<br/>';
                                        echo 
$error;
                                        echo 
'<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/editf/'.$id.'">Повторить<a/><br/>';
                                        echo 
'</div>';    
                                    }
                                else
                                    {
                                        
$mysqli->query("UPDATE `".$prefix."rekl` SET `link` = '".$link."' WHERE `id` = '".$id."'");
                                        echo 
'<div class="l1">';
                                        echo 
'Обманая ссылка успешно изменена.<br/>';
                                        echo 
'</div>';
                                    }
                            }
                    }
                else
                    {
                        echo 
'<div class="l1">';
                        echo 
'Данной Ссылки нет.<br/>';
                        echo 
'</div>';
                    }
            }
        else
            {
                echo 
'<div class="l1">';
                echo 
'Не выбрана ссылка.<br/>';
                echo 
'</div>';
            }
        break;
/////////////        
        
case 'edit':
        if(
$id)
            {
                
$isset $mysqli->query("SELECT * FROM `".$prefix."rekl` WHERE `id` = '".$id."'");
                if(
$isset->num_rows 0)
                    {
                        
$cat $isset->fetch_assoc();
                        echo 
'<div class="block">Изменение ссылки</div>';
                        if(!isset(
$_POST['ok']))
                            {
                                echo 
'
                                <div class="l1">
                                <form action="" method="post">
                                Имя ссылки [max.50]:<br/>
                                <input type="text" class="form" name="name" maxlength="50" value="'
.$cat['name'].'"/><br/>
                                Ссылка [max.30]:<br/>
                                <input type="text" class="form" name="link" maxlength="30" value="'
.$cat['link'].'"/><br/>
                                Цвет [max.6]:<br/>
                                <input type="text" class="form" name="color" maxlength="6" value="'
.$cat['color'].'"/><br/>                                
                                Место [max.2]:<br/>'
;
                                echo 
'<select name="stat">';
                                   echo 
'<option value="1">Верх</option><br/>';
                                echo 
'<option value="2">Партнеры</option><br/>';
                                echo 
'<option value="3">Вход/Статистика</option><br/>';
                                echo 
'</select><br/>';
                                echo 
'<input type="submit" class="button" name="ok" value="Изменить"/>
                                </form></div>'
;
                            }
                        else
                            {
                                
$name filter($_POST['name']);
                                
$link filter($_POST['link']);
                                
$color filter($_POST['color']);
                                
$stat abs(intval($_POST['stat']));
                                
$error '';
                                if(empty(
$link))
                                    {
                                        
$error .= 'Не заполнены поля.<br/>';
                                    }
                                if(
mb_strlen($name) > 50)
                                    {
                                        
$error .= 'Поле "Имя категории" больше 50 символов.<br/>';
                                    }
                                if(
mb_strlen($link) > 30)
                                    {
                                        
$error .= 'Поле "Ссылки" больше 30 символов.<br/>';
                                    }
                                if(
mb_strlen($color) > 6)
                                    {
                                        
$error .= 'Поле "Цвет" больше 6 символов.<br/>';
                                    }
                                if(
mb_strlen($stat) > 2)
                                    {
                                        
$error .= 'Поле "Место" больше 2 символов.<br/>';
                                    }    
                                if(!empty(
$error))
                                    {
                                        echo 
'<div class="l1">';
                                        echo 
'В результате заполнения полей , выявились ошибки:<br/>';
                                        echo 
$error;
                                        echo 
'<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama/edit/'.$id.'">Повторить<a/><br/>';
                                        echo 
'</div>';    
                                    }
                                else
                                    {
                                        
$mysqli->query("UPDATE `".$prefix."rekl` SET `name` = '".$name."',
                                        `link` = '"
.$link."',
                                        `stat` = '"
.$stat."',
                                        `color` = '"
.$color."'
                                        WHERE `id` = '"
.$id."'");
                                        echo 
'<div class="l1">';
                                        echo 
'Ссылка успешно изменена.<br/>';
                                        echo 
'</div>';
                                    }
                            }
                    }
                else
                    {
                        echo 
'<div class="l1">';
                        echo 
'Данной ссылка нет.<br/>';
                        echo 
'</div>';
                    }
            }
        else
            {
                echo 
'<div class="l1">';
                echo 
'Не выбрана ссылка категория.<br/>';
                echo 
'</div>';
            }
        break;
    }
echo 
'<div class="li">';
echo 
'<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel/reklama">К управлению рекламой</a><br/>';
echo 
'<a href="http://'.$_SERVER['HTTP_HOST'].'/controlPanel">В Админку</a><br/>';
echo 
'</div>';
?>
Онлайн: 3
Реклама