<?
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();

if (isset($_POST['save'])){

if (isset($_POST['up_panel']) && ($_POST['up_panel']==2 || $_POST['up_panel']==1 || $_POST['up_panel']==0))
{
$user['up_panel']=intval($_POST['up_panel']);
mysql_query("UPDATE `user` SET `up_panel` = '$user[up_panel]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Ошибка вида панели!'; 

if (isset($_POST['time']) && ($_POST['time']==1 || $_POST['time']==0))
{
$user['time']=intval($_POST['time']);
mysql_query("UPDATE `user` SET `time` = '$user[time]' WHERE `id` = '$user[id]' LIMIT 1");
}
else
{
$user['time']=0;
mysql_query("UPDATE `user` SET `time` = '0' WHERE `id` = '$user[id]' LIMIT 1");
}

if (!isset($err))msg('Изменения успешно приняты');
}
err();
aut();



echo "<form method='post' action='?$passgen'>\n";

echo "<div class='p_t'>";
echo "<img src='/images/up.png'> Верхняя панель:<br />";
echo "</div>";
echo "<input name='up_panel' type='radio' ".($user['up_panel']==0?' checked="checked"':null)." value='0' />Иконки";
if ($user['up_panel'] == 0)echo " <img src='/images/back.png'>";
echo "<br /><input name='up_panel' type='radio' ".($user['up_panel']==1?' checked="checked"':null)." value='1' />Слова";
if ($user['up_panel'] == 1)echo " <img src='/images/back.png'>";
echo "<br /><input name='up_panel' type='radio' ".($user['up_panel']==2?' checked="checked"':null)." value='2' />Буквы";
if ($user['up_panel'] == 2)echo " <img src='/images/back.png'>";

echo '<br />Отображать время: ';
echo "<label><input type='checkbox' name='time'".($user['time']?" checked='checked'":null)." value='1' /></label>";
if ($user['time']==1)echo " <img src='/images/ok.png'>";

echo "<div class='p_t'>";
echo "<input type='submit' name='save' value='Сохранить' />\n";
echo "</div>";
echo "</form>\n";

echo "<div class='foot'>\n";
if(isset($_SESSION['refer']) && $_SESSION['refer']!=NULL && otkuda($_SESSION['refer']))
echo "&laquo;<a href='$_SESSION[refer]'>".otkuda($_SESSION['refer'])."</a><br />\n";
echo "&laquo;<a href='umenu.php'>Мое меню</a><br />\n";
echo "</div>\n";
include_once 'sys/inc/tfoot.php';
?>