Файл: user/icon/pay.php
Строк: 337
<?php
/* DCMS Special
* Дата последнего редактирования 17.01.2016
* Модифицировал densnet
*/
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) {
require_once "../../sys/inc/$inc.php";
}
$doc->Title('Иконки');
require_once H . 'sys/inc/thead.php';
aut();
err();
only_reg();
$m1 = 200; // 1 месяц
$m2 = 350; // 2 месяца
$m3 = 600; // 3 месяца
$m4 = 650; // 4 месяца
$m5 = 800; // 5 месяцев
$m6 = 1000; // 6 месяцев
$m7 = 1100; // 7 месяцев
$m8 = 1200; // 8 месяцев
$m9 = 1350; // 9 месяцев
$m10 = 1500; // 10 месяцев
$m11 = 1600; // 11 месяцев
$g1 = 1800; // 1 год
$GetIcon = intval($_GET['id']);
if ($GetIcon < 1 or $GetIcon > 125) {
header('Location: index.php' . SID);
}
#Навигация
echo "<div class='card-header'>";
echo "<a href='/' data-toggle='tooltip' data-placement='right' title='" . lang('На главную') . "'><i class='fa fa-home fa-lg'></i></a> <i class='fa fa-angle-right fa-fw'></i> ";
echo "<a href='/?umenu'>" . lang('Кабинет') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo "<a href='/modules/shop/'>" . lang('Магазин') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo lang('Иконки');
echo "</div>";
echo "<div class='list-group-item'>";
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link active'>" . lang('Купить') . "</a></li>";
echo "<li class='nav-item'><a class='nav-link' href='index.php?get=my_icons'>" . lang('Мои иконки') . "</a></li>";
echo "</ul>";
echo "</div>";
if (isset($_POST['day']) and ( isset($_GET['get']))) {
if ($_POST['day'] == 'm1') {
if ($user['money'] >= $m1) {
$m1_time = $time + 2592000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $m1) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $m1_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
if ($_POST['day'] == 'm2') {
if ($user['money'] >= $m2) {
$m2_time = $time + 5184000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $m2) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $m2_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
if ($_POST['day'] == 'm3') {
if ($user['money'] >= $m3) {
$m3_time = $time + 7776000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $m3) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $m3_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
if ($_POST['day'] == 'm4') {
if ($user['money'] >= $m4) {
$m4_time = $time + 10368000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $m4) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $m4_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
if ($_POST['day'] == 'm5') {
if ($user['money'] >= $m5) {
$m5_time = $time + 12960000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $m5) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $m5_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
if ($_POST['day'] == 'm6') {
if ($user['money'] >= $m6) {
$m6_time = $time + 15552000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $m6) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $m6_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
if ($_POST['day'] == 'm7') {
if ($user['money'] >= $m7) {
$m7_time = $time + 18144000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $m7) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $m7_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
if ($_POST['day'] == 'm8') {
if ($user['money'] >= $m8) {
$m8_time = $time + 20736000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $m8) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $m8_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
if ($_POST['day'] == 'm9') {
if ($user['money'] >= $m9) {
$m9_time = $time + 23328000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $m9) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $m9_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
if ($_POST['day'] == 'm10') {
if ($user['money'] >= $m10) {
$m10_time = $time + 25920000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $m10) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $m10_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
if ($_POST['day'] == 'm11') {
if ($user['money'] >= $m11) {
$m11_time = $time + 28512000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $m11) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $m11_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
if ($_POST['day'] == 'g1') {
if ($user['money'] >= $g1) {
$g1_time = $time + 31103000;
mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] - $g1) . "' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_icon` (`id_user`, `id_icon`, `time`) VALUES ('" . $user['id'] . "', '" . $GetIcon . "', '" . $g1_time . "')");
header('Location: index.php?get=my_icons' . SID);
$_SESSION['message'] = lang('Иконка успешно приобретена');
} else {
$_SESSION['err'] = lang('Недостаточно средств');
header('Location: index.php?get=my_icons' . SID);
}
}
}
echo "<div class='list-group-item'><i class='fa fa-money fa-fw'></i> " . lang('Рубли') . " <span class='badge'>$user[money]</span></div>";
echo "<div class='list-group-item'>";
echo lang('Вы выбрали') . ": <img src='png/$GetIcon.png' />";
echo '<hr>';
echo lang('Стоимость использования') . ':';
echo "<form action='pay.php?get=ok&id=$GetIcon' method='POST'>";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='m1' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 1 " . lang('месяц') . " - $m1 " . lang('рублей') . "</label><br />";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='m2' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 2 " . lang('месяца') . " - $m2 " . lang('рублей') . "</label><br />";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='m3' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 3 " . lang('месяца') . " - $m3 " . lang('рублей') . "</label><br />";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='m4' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 4 " . lang('месяца') . " - $m4 " . lang('рублей') . "</label><br />";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='m5' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 5 " . lang('месяцев') . " - $m5 " . lang('рублей') . "</label><br />";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='m6' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 6 " . lang('месяцев') . " - $m6 " . lang('рублей') . "</label><br />";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='m7' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 7 " . lang('месяцев') . " - $m7 " . lang('рублей') . "</label><br />";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='m8' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 8 " . lang('месяцев') . " - $m8 " . lang('рублей') . "</label><br />";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='m9' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 9 " . lang('месяцев') . " - $m9 " . lang('рублей') . "</label><br />";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='m10' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 10 " . lang('месяцев') . " - $m10 " . lang('рублей') . "</label><br />";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='m11' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 11 " . lang('месяцев') . " - $m11 " . lang('рублей') . "</label><br />";
echo "<label class='c-input c-radio'><input name='day' type='radio' value='g1' /><span class='c-indicator'></span><i class='fa fa-smile-o fa-fw'></i> 1 " . lang('год') . " - $g1 " . lang('рублей') . "</label><br />";
$doc->Button('btn btn-success btn-sm', null, 'cart-plus', 'Купить');
echo "</form>";
echo '</div>';
require_once H . 'sys/inc/tfoot.php';