Файл: 3020.ru/file_3020/plugins/service.gradient.php
Строк: 130
<?
if ($level == 0){
header('Location: /index.php');
exit;
}
$colors = array(
"Красные" => array (
"IndianRed" => 0xCD5C5C,
"LightCoral" => 0xF08080,
"Salmon" => 0xFA8072,
"DarkSalmon" => 0xE9967A,
"LightSalmon" => 0xFFA07A,
"Crimson" => 0xDC143C,
"Red" => 0xFF0000,
"FireBrick" => 0xB22222,
"DarkRed" => 0x8B0000,
),
"Розовые" => array (
"Pink" => 0xFFC0CB,
"LightPink" => 0xFFB6C1,
"HotPink" => 0xFF69B4,
"DeepPink" => 0xFF1493,
"MediumVioletRed" => 0xC71585,
"PaleVioletRed" => 0xDB7093,
),
"Оранжевые" => array (
"Coral" => 0xFF7F50,
"Tomato" => 0xFF6347,
"OrangeRed" => 0xFF4500,
"DarkOrange" => 0xFF8C00,
"Orange" => 0xFFA500,
),
"Жёлтые" => array (
"Gold" => 0xFFD700,
"Yellow" => 0xFFFF00,
"LightYellow" => 0xFFFFE0,
"LemonChiffon" => 0xFFFACD,
"LightGoldenrodYellow" => 0xFAFAD2,
"PapayaWhip" => 0xFFEFD5,
"Moccasin" => 0xFFE4B5,
"PeachPuff" => 0xFFDAB9,
"PaleGoldenrod" => 0xEEE8AA,
"Khaki" => 0xF0E68C,
"DarkKhaki" => 0xBDB76B,
),
"Фиолетовые" => array (
"Lavender" => 0xE6E6FA,
"Thistle" => 0xD8BFD8,
"Plum" => 0xDDA0DD,
"Violet" => 0xEE82EE,
"Orchid" => 0xDA70D6,
"Fuchsia" => 0xFF00FF,
"Magenta" => 0xFF00FF,
"MediumOrchid" => 0xBA55D3,
"MediumPurple" => 0x9370DB,
"BlueViolet" => 0x8A2BE2,
"DarkViolet" => 0x9400D3,
"DarkOrchid" => 0x9932CC,
"DarkMagenta" => 0x8B008B,
"Purple" => 0x800080,
"Indigo" => 0x4B0082,
"SlateBlue" => 0x6A5ACD,
"DarkSlateBlue" => 0x483D8B,
),
"Зелёные" => array (
"GreenYellow" => 0xADFF2F,
"Chartreuse" => 0x7FFF00,
"LawnGreen" => 0x7CFC00,
"Lime" => 0x00FF00,
"LimeGreen" => 0x32CD32,
"PaleGreen" => 0x98FB98,
"LightGreen" => 0x90EE90,
"MediumSpringGreen" => 0x00FA9A,
"SpringGreen" => 0x00FF7F,
"MediumSeaGreen" => 0x3CB371,
"SeaGreen" => 0x2E8B57,
"ForestGreen" => 0x228B22,
"Green" => 0x008000,
"DarkGreen" => 0x006400,
"YellowGreen" => 0x9ACD32,
"OliveDrab" => 0x6B8E23,
"Olive" => 0x808000,
"DarkOliveGreen" => 0x556B2F,
"MediumAquamarine" => 0x66CDAA,
"DarkSeaGreen" => 0x8FBC8F,
"LightSeaGreen" => 0x20B2AA,
"DarkCyan" => 0x008B8B,
"Teal" => 0x008080,
),
"Синие" => array (
"Aqua" => 0x00FFFF,
"Cyan" => 0x00FFFF,
"LightCyan" => 0xE0FFFF,
"PaleTurquoise" => 0xAFEEEE,
"Aquamarine" => 0x7FFFD4,
"Turquoise" => 0x40E0D0,
"MediumTurquoise" => 0x48D1CC,
"DarkTurquoise" => 0x00CED1,
"CadetBlue" => 0x5F9EA0,
"SteelBlue" => 0x4682B4,
"LightSteelBlue" => 0xB0C4DE,
"PowderBlue" => 0xB0E0E6,
"LightBlue" => 0xADD8E6,
"SkyBlue" => 0x87CEEB,
"LightSkyBlue" => 0x87CEFA,
"DeepSkyBlue" => 0x00BFFF,
"DodgerBlue" => 0x1E90FF,
"CornflowerBlue" => 0x6495ED,
"MediumSlateBlue" => 0x7B68EE,
"RoyalBlue" => 0x4169E1,
"Blue" => 0x0000FF,
"MediumBlue" => 0x0000CD,
"DarkBlue" => 0x00008B,
"Navy" => 0x000080,
"MidnightBlue" => 0x191970,
),
"Коричневые" => array (
"Cornsilk" => 0xFFF8DC,
"BlanchedAlmond" => 0xFFEBCD,
"Bisque" => 0xFFE4C4,
"NavajoWhite" => 0xFFDEAD,
"Wheat" => 0xF5DEB3,
"BurlyWood" => 0xDEB887,
"Tan" => 0xD2B48C,
"RosyBrown" => 0xBC8F8F,
"SandyBrown" => 0xF4A460,
"Goldenrod" => 0xDAA520,
"DarkGoldenrod" => 0xB8860B,
"Peru" => 0xCD853F,
"Chocolate" => 0xD2691E,
"SaddleBrown" => 0x8B4513,
"Sienna" => 0xA0522D,
"Brown" => 0xA52A2A,
"Maroon" => 0x800000,
),
"Белые" => array (
"White" => 0xFFFFFF,
"Snow" => 0xFFFAFA,
"Honeydew" => 0xF0FFF0,
"MintCream" => 0xF5FFFA,
"Azure" => 0xF0FFFF,
"AliceBlue" => 0xF0F8FF,
"GhostWhite" => 0xF8F8FF,
"WhiteSmoke" => 0xF5F5F5,
"Seashell" => 0xFFF5EE,
"Beige" => 0xF5F5DC,
"OldLace" => 0xFDF5E6,
"FloralWhite" => 0xFFFAF0,
"Ivory" => 0xFFFFF0,
"AntiqueWhite" => 0xFAEBD7,
"Linen" => 0xFAF0E6,
"LavenderBlush" => 0xFFF0F5,
"MistyRose" => 0xFFE4E1,
),
"Серые" => array (
"Gainsboro" => 0xDCDCDC,
"LightGray" => 0xD3D3D3,
"Silver" => 0xC0C0C0,
"DarkGray" => 0xA9A9A9,
"Gray" => 0x808080,
"DimGray" => 0x696969,
"LightSlateGray" => 0x778899,
"SlateGray" => 0x708090,
"DarkSlateGray" => 0x2F4F4F,
"Black" => 0x000000,
)
);
if (isset($_GET['act']) && isset($_GET['color']) && ($_GET['act'] == 'color1' || $_GET['act'] == 'color2') && preg_match("/^([A-z0-9]{3,20})$/", $_GET['color'])){
if ($_GET['act'] == 'color1') {
$_SESSION['color1'] = text($_GET['color']);
} elseif ($_GET['act'] == 'color2') {
$_SESSION['color2'] = text($_GET['color']);
}
header('Location: ?func=' . $func);
exit;
}
if (isset($_POST['color1'])) {
$user['color1'] = $_POST['color1'];
$user['color2'] = $_POST['color2'];
if (!preg_match("/^#?([A-z0-9]{6}|[A-z0-9]{3})$/", $user['color1'])) {
$err[] = 'В цвете №1 присутствуют запрещенные символы';
}
if (!preg_match("/^#?([A-z0-9]{6}|[A-z0-9]{3})$/", $user['color2'])) {
$err[] = 'В цвете №2 присутствуют запрещенные символы';
}
if ($system['user_coins_gradient'] > $user['wmr']) {
$err[] = 'У вас не достаточно средств';
}
if (!isset($err)) {
$msg = 'Оплата услуги смены градиента ника';
$sql -> insert("INSERT INTO `billing_log` (`wmid`, `purse`, `time`, `type`, `id_user`, `coins`, `msg`) VALUES ('0', '0', '$time', 'service', '$user[id]', '-" . $system['user_coins_gradient'] . "', '$msg')");
$sql -> update("UPDATE `users` SET `color1` = '$user[color1]', `color2` = '$user[color2]', `wmr` = `wmr` - '$system[user_coins_gradient]' WHERE `id` = '$user[id]' LIMIT 1");
unset($_SESSION['color1']);
unset($_SESSION['color2']);
$_SESSION['message'] = 'Градиент для вашего ника установлен';
header('Location: ?func=' . $func);
exit;
}
}
if (isset($_SESSION['color1'])) {
$user['color1'] = text($_SESSION['color1']);
}
if (isset($_SESSION['color2'])) {
$user['color2'] = text($_SESSION['color2']);
}
$system['title'] = 'Покупка градиента для ника';
require SYS . 'header.php';
if (isset($_GET['act']) && ($_GET['act'] == 'color1' || $_GET['act'] == 'color2')){
foreach ($colors as $group => $colors) {
echo '<div class="title">' . $group . '</div>';
echo '<table>';
foreach ($colors as $color_name => $color_value) {
$save_vars[] = $color_value;
echo '<tr>';
echo '<td style="width: 16px; height: 16px; border: 1px solid #000; background-color: #'.sprintf("%06X", $color_value).'"></td>';
echo '<td><a href="?func=' . $func . '&act=' . text($_GET['act']) . '&color=' . sprintf("%06X", $color_value) . '">'.$color_name.'</a></td>';
echo '</tr>';
}
echo '</table>';
}
} else {
?>
<div class="alert" style="margin: 2px; margin-bottom: 6px;">
Стоимость смены градиента ника составляет: <b><?= $system['user_coins_gradient']?> wmr</b><br />
У вас на счету: <b><?= $user['wmr']?> wmr</b><br />
</div>
<? if ($user['color1'] && $user['color2']) { ?>
<div class="nav1">
Предпросмотр: <?= gradient(login($user['id']), $user['color1'], $user['color2'])?>
</div>
<? } ?>
<div class="nav2">
<form class="form-horizontal" action="?func=<?= $func?>" method="POST" style="margin: 2px;">
<div class="control-group">
<label class="control-label" for="color1">Начало (Цвет №1)</label>
<div class="controls">
#<input type="text" id="color1" name="color1" value="<?= $user['color1']?>" /> [<a href="?func=<?= $func?>&act=color1">выбрать цвет</a>]
</div>
</div>
<div class="control-group">
<label class="control-label" for="color2">Конец (Цвет №2)</label>
<div class="controls">
#<input type="text" id="color2" name="color2" value="<?= $user['color2']?>" /> [<a href="?func=<?= $func?>&act=color2">выбрать цвет</a>]
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Сохранить</button>
</div>
</div>
</form>
</div>
<?
}
?>
<div class="foot">
« <a href="?func=service">Дополнительные услуги</a>
</div>