Вход Регистрация
Файл: foot_set.php
Строк: 172
<?
include_once 'sys/inc/start.php';
include_once 
'sys/inc/compress.php';
include_once 
'sys/inc/sess.php';
include_once 
'sys/inc/home.php';
include_once 
'sys/inc/settings.php';
include_once 
'sys/inc/db_connect.php';
include_once 
'sys/inc/ipua.php';
include_once 
'sys/inc/fnc.php';
include_once 
'sys/inc/user.php';

only_reg();
$set['title']='Настройка нижний панели навигации';
include_once 
'sys/inc/thead.php';
title();
err();
echo
"<div class='act'>
<a class='act_noactive' href='/settings/'>Настройки</a>"
;
echo
'<a class="act_active">Нижняя панель</a></div>';
aut();

if ((!isset(
$_SESSION['refer']) || $_SESSION['refer']==NULL)
&& isset(
$_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']!=NULL &&
!
preg_match('#foot_set.php#',$_SERVER['HTTP_REFERER']))
$_SESSION['refer']=str_replace('&','&amp;',preg_replace('#^http://[^/]*/#','/', $_SERVER['HTTP_REFERER']));


function 
my_int($var){$var = abs((int)$var);return $var;} //функция фильтра цифр

$do = (isset($_GET['do'])) ? $_GET['do'] : NULL;
switch(
$do) {
default:

        
/* УПРАВЛЕНИЕ ССЫЛКАМИ */

            // удаление ссылки
    
if (isset($_GET['x'])) {
        
$x = my_int($_GET['x']);
        
$EmptyLink = mysql_query("SELECT `id` FROM `foot_links` WHERE `user` = '$user[id]' AND `id` = '$x' LIMIT 1");
    if (
mysql_num_rows($EmptyLink) != FALSE) {
            
mysql_query("DELETE FROM `foot_links` WHERE `user` = '$user[id]' AND `id` = '$x' LIMIT 1");
            
header('Location: foot_set.php?');
        } else {
            
header('Location: foot_set.php?');
        }
    }

    
// Предвижение ссылки вверх
    
if (isset($_GET['up'])) {
        
$up = my_int($_GET['up']);
        
$SqlMyLink = mysql_query("SELECT `id`, `sort` FROM `foot_links` WHERE `id` = '$up' AND `user` = '$user[id]' LIMIT 1");
        
$IsSqlMyLink2 = mysql_fetch_array($SqlMyLink);
        if (
mysql_num_rows($SqlMyLink) == FALSE) {
            
header('Location: foot_set.php?');
        } else {
            
$InSqlMyLink = mysql_query("SELECT `id`, `sort` FROM `foot_links` WHERE `sort` = '" . ($IsSqlMyLink2[1] - 1) . "' AND `user` = '$user[id]' LIMIT 1");
        if (
mysql_num_rows($InSqlMyLink) == FALSE) {
            
header('Location: foot_set.php?');
        } else {
            
$IsSqlMyLink1 = mysql_fetch_array($InSqlMyLink);
            
mysql_query("UPDATE `foot_links` SET `sort` = '$IsSqlMyLink1[1]' WHERE `id` = '$up' AND `user` = '$user[id]' LIMIT 1");
            
mysql_query("UPDATE `foot_links` SET `sort` = '$IsSqlMyLink2[1]' WHERE `id` = '$IsSqlMyLink1[0]' AND `user` = '$user[id]' LIMIT 1");
            
header('Location: foot_set.php?');
        }
        }
    }

    
// Передвижение ссылки вниз
    
if (isset($_GET['down'])) {
        
$down = my_int($_GET['down']);
        
$SqlMyLink = mysql_query("SELECT `id`, `sort` FROM `foot_links` WHERE `id` = '$down' AND `user` = '$user[id]' LIMIT 1");
        
$IsSqlMyLink2 = mysql_fetch_array($SqlMyLink);
        if (
mysql_num_rows($SqlMyLink) == FALSE) {
            
header('Location: foot_set.php?');
        } else {
            
$InSqlMyLink = mysql_query("SELECT `id`, `sort` FROM `foot_links` WHERE `sort` = '" . ($IsSqlMyLink2[1] + 1) . "' AND `user` = '$user[id]' LIMIT 1");
        if (
mysql_num_rows($InSqlMyLink) == FALSE) {
            
header('Location: foot_set.php?');
        } else {
            
$IsSqlMyLink1 = mysql_fetch_array($InSqlMyLink);
            
mysql_query("UPDATE `foot_links` SET `sort` = '$IsSqlMyLink1[1]' WHERE `id` = '$down' AND `user` = '$user[id]' LIMIT 1");
            
mysql_query("UPDATE `foot_links` SET `sort` = '$IsSqlMyLink2[1]' WHERE `id` = '$IsSqlMyLink1[0]' AND `user` = '$user[id]' LIMIT 1");
            
header('Location: foot_set.php?');
        }
        }
    }

echo 
'<div class="block"><a href="foot_set.php?do=link"><img src="/style/nav/lj.gif" alt="+"/> Добавить ссылку</a></div>';

    
// вывод моих ссылок
    
$FootLinks = mysql_query("SELECT * FROM `foot_links` WHERE `user` = '$user[id]' ORDER BY `sort` ASC");
    while(
$FootLink = mysql_fetch_assoc($FootLinks)) {
        
$down = '<a href="foot_set.php?down='.$FootLink['id'].'"><img src="/style/nav/down.gif" alt="D"/></a> ';
        
$up = '<a href="foot_set.php?up='.$FootLink['id'].'"><img src="/style/nav/up.gif" alt="U"/></a> ';

echo 
'<div class="hide">' . $down . $up . $FootLink['name'] . ' <a style="float:right" href="foot_set.php?x='.$FootLink['id'].'"><img src="/style/nav/del.gif" alt="X"/></a></div>';
    }

break;

case 
'link':

        
/* ДОБАВЛЕНИЕ ССЫЛКИ */

    
if (isset($_GET['a'])) {
        
$a = my_int($_GET['a']);

        
$MyLink = mysql_query("SELECT * FROM `foot_links` WHERE `user` = '$user[id]' AND `uid` = '$a' LIMIT 1");

        if (
$a < 1 || $a > 11) {
            
header('Location: foot_set.php?do=link');
            die();
        }

        if (
$a == 1) {
            
$SetLink = '/index?';
$SetName = 'Глав';
        }
        if (
$a == 2) {
            
$SetLink = '/user/bookmark/index.php?id=' . $user['id'];
            
$SetName = 'Закл';
        }
        if (
$a == 3) {
            
$SetLink = '/info.php?id='.$user['id'];
            
$SetName = 'Я';
        }
        if (
$a == 4) {
            
$SetLink = '/konts.php?';
            
$SetName = 'Поч';
        }
        if (
$a == 5) {
            
$SetLink = '/user/frends/?id=' . $user['id'];
            
$SetName = 'Др';
        }
        if (
$a == 6) {
            
$SetLink = '/user/love/index.php?';
            
$SetName = 'Знак';
        }
        if (
$a == 7) {

            
$SetLink = '/chat/index.php?';
            
$SetName = 'Чат';
        }
        if (
$a == 8) {
            
$SetLink = '/forum/index.php?';
            
$SetName = 'Фор';
        }

        if (
$a == 9) {
            
$SetLink = '/obmen/index.php?';
            
$SetName = 'ЗО';
        }

        if (
$a == 10) {
            
$SetLink = '/plugins/rules/index.php?';
            
$SetName = 'Пом';
        }
        if (
$a == 11) {
            
$SetLink = '/exit.php?';
            
$SetName = 'Вых';
        }

        if (
mysql_num_rows($MyLink) == FALSE) {
            
$lst = mysql_fetch_array(mysql_query("SELECT `sort` FROM `foot_links` ORDER BY `sort` DESC LIMIT 1"));
            
$Rnd = mt_rand(10000, 9999999);
            
mysql_query("INSERT INTO `foot_links` SET `id` = '$Rnd', `user` = '$user[id]', `link` = '$SetLink', `name` = '$SetName', `uid` = '$a', `sort` = '" . ($lst[0] + 1) . "'");
            
header('Location: foot_set.php?');
        } else {
            
header('Location: foot_set.php?');
        }
    }

    
$FootFile = file('foot_str.dat');
    
$FootStr = file_get_contents('foot_str.dat');
    
$FootEx = explode('|', $FootStr);


    for(
$strs = 0, $FootFile = count($FootFile); $strs < $FootFile; ++$strs)
    {
        
$Sql = mysql_fetch_assoc(mysql_query("SELECT `uid` FROM `foot_links` WHERE `user` = '$user[id]' AND `uid` = '" . ($strs + 1) . "'"));
        if (
$Sql['uid'] != $strs + 1) {

            echo 
'<div class="block">' . $FootEx[$strs] . '</div>';

        }
    }

echo 
'<div class="hide"><a href="/foot_set?">&laquo; Назад</a></div>';
break;


}

include_once 
'sys/inc/tfoot.php';
?>
Онлайн: 1
Реклама