<?php

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';
$set['title']='Цвет логина';
include_once '../../sys/inc/thead.php';
title();
err();
aut();

$action=htmlspecialchars(trim($_GET['action']));
$color=mysql_fetch_array(mysql_query("SELECT * FROM `ncolor`"));

$success = '<div class="block"><center><img width="100" src="/img/success.png"></br></br>Вы успешно изменили цвет вашего логина, теперь вашь аккаунт выглядит более красочным!</br>С вашего счета были списаны коины за смену цвета</center></div>';
$success_no = '<div class="block"><center><img width="100" src="/img/success_no.png"></br></br>У вас не достаточно средств для смены цвета логина</center></div>';

switch ($action){

default:
echo '<a class="link3" href="login_color.php?action=stand"><img class="icon" src="/img/login_color.png"> Обычные цвета</a>';
echo '<a class="link3" href="login_color.php?action=gradient"><img class="icon" src="/img/login_color.png"> Градиентовые цвета</a>';
break;


case 'stand':
if (isset($user) & $user['money'] < $color[cena2]){
echo '<div class="block4">';
echo 'У вас не достаточно коинов';
echo '</div>';
}else{
echo '<div class="block"><center>Стоимость услуги <b><font color="#009688">'.$color[cena2].'</font></b> <img style="width: 18px; margin: -5px 5px 0 5px;" src="/img/coins.png"> coins</center></div>';

echo '<a class="link3" href="login_color.php?action=sav1"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#FF0000", "#FF0000");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav2"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#D2691E", "#D2691E");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav3"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#FF1493", "#FF1493");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav4"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#0000FF", "#0000FF");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav5"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#008000", "#008000");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav6"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#FFFF00", "#FFFF00");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav7"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#FFD700", "#FFD700");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav8"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#FFA500", "#FFA500");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav9"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#8B008B", "#8B008B");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav10"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#000000", "#000000");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav11"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#696969", "#696969");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav13"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#669999", "#669999");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=sav14"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#00FF00", "#00FF00");
echo '</b></a>';

}
break;

case 'sav1':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#FF0000'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FF0000'  WHERE `id` = '$user[id]'");
echo $success; } break;
case 'sav2':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#D2691E'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#D2691E'  WHERE `id` = '$user[id]'");
echo $success; } break;
case 'sav3':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#FF1493'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FF1493'  WHERE `id` = '$user[id]'");
echo $success; } break;

case 'sav4':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#0000FF'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#0000FF'  WHERE `id` = '$user[id]'");
echo $success; } break;

case 'sav5':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#008000'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#008000'  WHERE `id` = '$user[id]'");
echo $success; } break;

case 'sav6':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#FFFF00'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FFFF00'  WHERE `id` = '$user[id]'");
echo $success; } break;

case 'sav7':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#FFD700'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FFD700'  WHERE `id` = '$user[id]'");
echo $success; } break;

case 'sav8':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#FFA500'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FFA500'  WHERE `id` = '$user[id]'");
echo $success; } break;

case 'sav9':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#8B008B'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#8B008B'  WHERE `id` = '$user[id]'");
echo $success; } break;

case 'sav10':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#000000'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#000000'  WHERE `id` = '$user[id]'");
echo $success; } break;

case 'sav11':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#696969'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#696969'  WHERE `id` = '$user[id]'");
echo $success; } break;

case 'sav12':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#FFFFFF'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FFFFFF'  WHERE `id` = '$user[id]'");
echo $success; } break;

case 'sav13':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#669999'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#669999'  WHERE `id` = '$user[id]'");
echo $success; } break;

case 'sav14':
if (isset($user) & $user['money'] < $color[cena2])
{
echo $success_no;
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#00FF00'  WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#00FF00'  WHERE `id` = '$user[id]'");
echo $success; } break;




case 'gradient':
if (isset($user) & $user['money'] < $color[cena1]){
echo '<div class="block4">';
echo 'У вас не достаточно коинов';
echo '</div>';
}
else
{
echo '<div class="block"><center>Стоимость услуги <b><font color="#009688">'.$color[cena1].'</font></b> <img style="width: 18px; margin: -5px 5px 0 5px;" src="/img/coins.png"> coins</center></div>';

echo '<a class="link3" href="login_color.php?action=save1"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#00008B", "#FFA500");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=save2"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#00FF00", "#0000FF");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=save3"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#000000", "#4B0082");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=save4"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#000080", "#008000");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=save5"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#0000FF", "#FFFF00");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=save6"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#FFFF00", "#0000FF");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=save7"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#9932CC", "#006400");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=save8"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#696969", "#DC143C");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=save9"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#7CFC00", "#B22222");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=save10"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#FF0000", "#0000CD");
echo '</b></a>';


echo '<a class="link3" href="login_color.php?action=save11"><b>';
echo '<img class="icon" src="/img/login_color.png"> '.GradientText("$user[nick]", "#0000CD", "#FF0000");
echo '</b></a>';

}
break;
case 'save1':
if (isset($user) & $user['money'] < $color[cena1])
{
echo "Недостаточно coins.Надо :$color[cena1] coins.А у вас <b>$user[money]</b>\n";
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena1'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#00008B' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FFA500' WHERE `id` = '$user[id]'");
echo $success; } break;
case 'save2':
if (isset($user) & $user['money'] < $color[cena1])
{
echo "Недостаточно coins.Надо :$color[cena1] coins.А у вас <b>$user[money]</b>\n";
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena1'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#00FF00' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#0000FF' WHERE `id` = '$user[id]'");
echo $success; } break;
case 'save3':
if (isset($user) & $user['money'] < $color[cena1])
{
echo "Недостаточно coins.Надо :$color[cena1] coins.А у вас <b>$user[money]</b>\n";
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena1'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#00FFFF' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FAF0E6' WHERE `id` = '$user[id]'");
echo $success; } break;
case 'save4':
if (isset($user) & $user['money'] < $color[cena1])
{
echo "Недостаточно coins.Надо :$color[cena1] coins.А у вас <b>$user[money]</b>\n";
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena1'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#000080' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#008000' WHERE `id` = '$user[id]'");
echo $success; } break;
case 'save5':
if (isset($user) & $user['money'] < $color[cena1])
{
echo "Недостаточно coins.Надо :$color[cena1] coins.А у вас <b>$user[money]</b>\n";
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena1'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#0000FF' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FFFF00' WHERE `id` = '$user[id]'");
echo $success; } break;
case 'save6':
if (isset($user) & $user['money'] < $color[cena1])
{
echo "Недостаточно coins.Надо :$color[cena1] coins.А у вас <b>$user[money]</b>\n";
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena1'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#FFFF00' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#0000FF' WHERE `id` = '$user[id]'");
echo $success; } break;
case 'save7':
if (isset($user) & $user['money'] < $color[cena1])
{
echo "Недостаточно coins.Надо :$color[cena1] coins.А у вас <b>$user[money]</b>\n";
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena1'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#9932CC' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FF1493' WHERE `id` = '$user[id]'");
echo $success; } break;
case 'save8':
if (isset($user) & $user['money'] < $color[cena1])
{
echo "Недостаточно coins.Надо :$color[cena1] coins.А у вас <b>$user[money]</b>\n";
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena1'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#696969' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FFDEAD' WHERE `id` = '$user[id]'");
echo $success; } break;
case 'save9':
if (isset($user) & $user['money'] < $color[cena1])
{
echo "Недостаточно coins.Надо :$color[cena1] coins.А у вас <b>$user[money]</b>\n";
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena1'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#7CFC00' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#B22222' WHERE `id` = '$user[id]'");
echo $success; } break;
case 'save10':
if (isset($user) & $user['money'] < $color[cena1])
{
echo "Недостаточно coins.Надо :$color[cena1] coins.А у вас <b>$user[money]</b>\n";
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena1'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#FF0000' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#0000CD' WHERE `id` = '$user[id]'");
echo $success; } break;
case 'save11':
if (isset($user) & $user['money'] < $color[cena1])
{
echo "Недостаточно coins.Надо :$color[cena1] coins.А у вас <b>$user[money]</b>\n";
}else{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$color['cena1'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#0000CD' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FF0000' WHERE `id` = '$user[id]'");
echo $success; } break;

}
include_once '../../sys/inc/tfoot.php';

?>