Файл: user/settings/stat.php
Строк: 163
<?php
/* Мод "Статы"
* Версия v0.0.1
* Дата последнего редактирования 21.11.2014
* Двиг DCMS Special
* Модифицировал densnet
* Файл stat.php
* Описание: дает возможность пользователю, ставить мини картинки на своей странице, на обозрение всем
*/
require_once '../../sys/inc/start.php';
require_once '../../sys/inc/compress.php';
require_once '../../sys/inc/sess.php';
require_once '../../sys/inc/settings.php';
require_once '../../sys/inc/db_connect.php';
require_once '../../sys/inc/ipua.php';
require_once '../../sys/inc/fnc.php';
require_once '../../sys/inc/user.php';
$set['title'] = 'Статы';
user::only_reg();
require_once '../../sys/inc/thead.php';
title();
aut();
#Навигация
echo "<div class = 'razd'><a href = '/index.php'>Главная</a> > <a href = '/umenu.php'>Кабинет</a> > <a href = '?'><b>Статы</b></a></div>";
$q = mysql_query("SELECT * FROM `user` WHERE `id` = '$user[id]' LIMIT 1");
$user = mysql_fetch_assoc($q);
$stat = mysql_fetch_array(mysql_query("SELECT * FROM `stat` WHERE `user_id` = '" . $user['id'] . "'"));
$act = (isset($_GET['act'])) ? htmlspecialchars($_GET['act']) : null;
switch ($act) {
case 'buy':
echo "<div class = 'msgs'>";
echo img('money.png') . " Ваши монеты: $user[money] (<font color = 'red'>Вам скидки нет</font>)<br />";
echo "Выберите себе стат. Картинка будет на вашей странице 7 дней";
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/1.png' /><br />";
echo "Балалайка (100 монет)<br />";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=1'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/2.png' /><br />";
echo "Козина (100 монет)<br />";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=2'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/3.png' /><br />";
echo "Бабочка (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=3'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/4.png' /><br />";
echo "Пасха (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=4'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/5.png' /><br />";
echo "Колокол (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=5'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/6.png' /><br />";
echo "Дельфин (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=6'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/7.png' /><br />";
echo "Яйцо (200 монет)<br/>";
if ($user['money'] >= 200) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=7'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/8.png' /><br />";
echo "Слон (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=8'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/9.png' /><br />";
echo "Гиппопотам (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=9'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/10.png' /><br />";
echo "Матрешка (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=10'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/11.png' /><br />";
echo "Панда (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=11'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/12.png' /><br />";
echo "Заяц (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=12'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/13.png' /><br />";
echo "Самовар (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=13'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/14.png' /><br />";
echo "Серп и Молот (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=14'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/15.png' /><br />";
echo "Черепаха (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=15'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div><div class = 'razd'>";
echo "<img src = '/style/stat/16.png' /><br />";
echo "Валенки (100 монет)<br/>";
if ($user['money'] >= 100) {
echo "<form method = 'post' name = 'message' action = '?act=ok&select=16'>";
echo "<button class = 'add'>Купить</button>";
echo "</form>";
} else {
echo "Купить<br />";
}
echo "</div>";
echo "<div class = 'razd'>" . img('left.png') . " <a href = '/user/stat.php'>Назад</a></div>";
break;
case 'ok':
$select = abs(intval($_GET['select']));
if ($select == 1) {
$price = $user['money'] - 100;
}
if ($select == 2) {
$price = $user['money'] - 100;
}
if ($select == 3) {
$price = $user['money'] - 100;
}
if ($select == 4) {
$price = $user['money'] - 100;
}
if ($select == 5) {
$price = $user['money'] - 100;
}
if ($select == 6) {
$price = $user['money'] - 100;
}
if ($select == 7) {
$price = $user['money'] - 200;
}
if ($select == 8) {
$price = $user['money'] - 100;
}
if ($select == 9) {
$price = $user['money'] - 100;
}
if ($select == 10) {
$price = $user['money'] - 100;
}
if ($select == 11) {
$price = $user['money'] - 100;
}
if ($select == 12) {
$price = $user['money'] - 100;
}
if ($select == 13) {
$price = $user['money'] - 100;
}
if ($select == 14) {
$price = $user['money'] - 100;
}
if ($select == 15) {
$price = $user['money'] - 100;
}
if ($select == 16) {
$price = $user['money'] - 100;
}
if ($select >= 1 AND $select <= 16) {
if ($price >= 0) {
echo "<div class = 'msgs'>";
echo "Стат успешно куплен!<br />";
echo img('left.png') . "<a href = '/info.php'>В профиль</a>";
mysql_query("UPDATE `stat` SET `stat_id` = '$select', `time` = '$time' WHERE `user_id` = '" . $user['id'] . "'");
mysql_query("UPDATE `user` SET `money` = '$price' WHERE `id` = '" . $user['id'] . "'");
echo "</div>";
} else {
echo "<div class = 'errs'>";
echo "Операция не выполнена";
echo "</div>";
}
} else {
echo "<div class = 'errs'>";
echo "Операция не выполнена";
echo "</div>";
}
break;
default:
if (isset($user)) {
echo "<form method = 'post' class = 'razd' name = 'message' action = '?act=buy'>";
echo "Стат - это мини картинка, которая появится на вашей странице... И будет видна всем<br />";
echo "<button class = 'button'>";
echo "<span class = 'label'>Выбрать</span>";
echo "</button></form>n";
}
echo "<div class = 'razd'>" . img('left.png') . " <a href = '/umenu.php'>Кабинет</a></div>";
if (!isset($stat['user_id'])) {
mysql_query("INSERT INTO `stat` SET `user_id` = '" . $user['id'] . "'");
}
break;
}
require_once '../../sys/inc/tfoot.php';