View file user/info/color_panel.php

File size: 2.65Kb
<?
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';


if(!isset($user)){
	$_SESSION['err'] = 'Ошибка! Попробуйте еще раз!';  
	header("Location: /");  
	exit;
}


$set['title'] = 'Цвет панелей';
include_once '../../sys/inc/thead.php';
title();
aut();
err();

if (isset($_GET['select']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `user_panel_colors` WHERE `id` = '".intval($_GET['select'])."'"), 0)) {

$color = mysql_fetch_array(mysql_query("SELECT * FROM `user_panel_colors` WHERE `id` = '".intval($_GET['select'])."'"));

if ($color['color'] != $user['user_panel_colors']) {
	mysql_query("UPDATE `user` SET `user_panel_colors` = '$color[color]' WHERE `id` = '$user[id]'");
	
	$_SESSION['message'] = 'Вы успешно изменили цвет панелей.';
	header("Location: ?");
	exit;	
}
else{
	$_SESSION['err'] = 'У Вас установлен этот цвет панелей.';
	header("Location: ?");
	exit;	
}

}elseif (isset($_GET['null'])){
	mysql_query("UPDATE `user` SET `user_panel_colors` = '' WHERE `id` = '$user[id]'");
	
	$_SESSION['message'] = 'Вы успешно убрали цвет панелей.';
	header("Location: ?");
	exit;	
}


?>
<div style="padding: 1px 10px 10px 10px;background-color: #f5f5f5;">
<div style="position: relative;margin-bottom:0;">

<div style="margin: 10px;text-align: center;">  
<b style="text-transform: uppercase;"><!--   --><span>Выберите один из цветов</span> </b>  &nbsp;    <!-- -->  
</div>

<div style="text-align: center; padding: 0 5px;">
<?


$q = mysql_query("SELECT * FROM `user_panel_colors`");

while ($color = mysql_fetch_array($q)) {
echo "<a style='background-color: #{$color['color']}; width: 40px; height: 40px; display: inline-block; border-radius: 4px;".($user['user_panel_colors'] == $color['color']?" background-image: url(/style/panel_color/ok_color.png); background-position: center center; background-repeat: no-repeat;":null)."' href='?color&select=".$color['id']."'></a>\n";
}
if($user['user_panel_colors'] != null){
echo "<a style='background-color: #FFE4C4; width: 40px; height: 40px; display: inline-block; border-radius: 4px;background-image: url(/style/panel_color/dell_color.png); background-position: center center; background-repeat: no-repeat;' href='?null'></a>\n";
}
?>
</div>
</div>


</div>
<?


include_once '../../sys/inc/tfoot.php';
?>