Файл: modules/user/shop_color.php
Строк: 93
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
if(!User::logged())
{
go('/');
}
$locate = 'in_cabinet';
$title = _t('shop');
include_header($title);
Template::div('title', _t('color_nick'));
if(isset($_POST['save']) && $user['balance'] >= 15)
{
$color = input($_POST['color']);
$colors = array('008000', 'FF0000', 'FF8C00', '0000CD', 'EE82EE', '000000', 'A0522D');
if(in_array($color, $colors))
{
$db->query("UPDATE `users` SET `color_nick` = '". $color."' WHERE `id` = '". $user['id'] ."'");
$db->query("UPDATE `users` SET `balance` = '". ($user['balance']-15)."' WHERE `id` = '". $user['id'] ."'");
Template::div('menu', _t('yes_color'));
Template::div('block', img('shop.png') .'<a href="/user/shop/">'. _t('shop') .'</a> <br/>'. NAV .'<a href="/user/panel/">'._t('user_panel').'</a><br/>' . HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
exit;
}
}
if(isset($_GET['act']) && $_GET['act'] == 'clear' && !empty($user['color_nick']))
{
$db->query("UPDATE `users` SET `color_nick` = '' WHERE `id` = '". $user['id'] ."'");
Template::div('menu', _t('succ_save'));
Template::div('block', img('shop.png') .'<a href="/user/shop/">'. _t('shop') .'</a> <br/>'. NAV .'<a href="/user/panel/">'._t('user_panel').'</a><br/>' . HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
exit;
}
if (!empty($user['color_nick'])) Template::div('menu', '<a href="/user/shop_color/?act=clear">'. _t('clear_color') .'</a><br/>');
Template::div('menu', _t('sum_service') .': <b>15</b> '._t('balance'));
if ($user['balance'] >= 15)
{
echo '<div class="post">
<form action="/user/shop_color/" method="post">
<input type="radio" value="008000" name="color" checked="checked" /> <span style="color:#008000;">'. _t('green') .'</span><br />
<input type="radio" value="FF0000" name="color" /> <span style="color:#FF0000;">'. _t('red') .'</span><br />
<input type="radio" value="FF8C00" name="color" /> <span style="color:#FF8C00;">'. _t('orange') .'</span><br />
<input type="radio" value="0000CD" name="color" /> <span style="color:#0000CD;">'. _t('blue') .'</span><br />
<input type="radio" value="EE82EE" name="color" /> <span style="color:#EE82EE;">'. _t('violet') .'</span><br />
<input type="radio" value="000000" name="color" /> <span style="color:#000000;">'. _t('black') .'</span><br />
<input type="radio" value="A0522D" name="color" /> <span style="color:#A0522D;">'. _t('brown') .'</span><br />
<input type="submit" name="save" value="'. _t('save') .'" /><br/>
</form>
</div>';
}
else
{
Template::div('menu', _t('no_balance'));
}
Template::div('block', img('shop.png') .'<a href="/user/shop/">'. _t('shop') .'</a> <br/>'. NAV .'<a href="/user/panel/">'._t('user_panel').'</a><br/>' . HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
?>