2018-01-28 16:40:49 +00:00
|
|
|
|
<?php
|
|
|
|
|
session_start();
|
2020-07-05 17:15:45 +00:00
|
|
|
|
include_once 'config.php';
|
2020-07-04 10:49:43 +00:00
|
|
|
|
include_once 'models/PresentsModel.php';
|
2020-07-05 16:43:15 +00:00
|
|
|
|
|
2020-07-03 16:19:18 +00:00
|
|
|
|
$login = urldecode($_SERVER['QUERY_STRING']) ?? '';
|
2020-07-03 13:27:31 +00:00
|
|
|
|
$uid = $_SESSION['uid'] ?? null;
|
2020-07-03 16:19:18 +00:00
|
|
|
|
$user = new User($login);
|
2020-07-03 14:14:08 +00:00
|
|
|
|
const MODERATOR_ACCESS = 1;
|
|
|
|
|
const ADMINISTRATOR_ACCESS = 2;
|
2020-07-05 16:43:15 +00:00
|
|
|
|
|
2020-07-03 14:14:08 +00:00
|
|
|
|
function private_access($uid)
|
|
|
|
|
{
|
|
|
|
|
$own = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = "?s"', $uid)->fetch_assoc();
|
|
|
|
|
if ($own['admin'] === 1) {
|
|
|
|
|
return ADMINISTRATOR_ACCESS;
|
|
|
|
|
} elseif ($own['align'] === 1) {
|
|
|
|
|
return MODERATOR_ACCESS;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-04 10:49:43 +00:00
|
|
|
|
$presentsModel = new PresentsModel();
|
|
|
|
|
$presentsList = $presentsModel->getAllPresents($user->id);
|
|
|
|
|
|
2020-07-03 13:23:08 +00:00
|
|
|
|
if (empty($user->id)): ?>
|
2020-06-23 05:11:07 +00:00
|
|
|
|
<!doctype html>
|
|
|
|
|
<html lang="ru">
|
2019-01-16 01:22:09 +00:00
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
2019-01-28 17:56:21 +00:00
|
|
|
|
<title>Ошибка</title>
|
|
|
|
|
</head>
|
2018-01-29 16:18:56 +00:00
|
|
|
|
<body style="color: #666; background-color: #d5d5d5; text-align: center; font-family: Consolas,monospace;">
|
2020-07-05 07:12:48 +00:00
|
|
|
|
Ошибка: персонаж <em><?= $login ?></em> не найден...
|
2018-01-29 16:18:56 +00:00
|
|
|
|
<p><a style="color: #99f" href="javascript:window.history.go(-1);">←назад</a></p>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
</body>
|
|
|
|
|
</html>
|
2020-06-23 05:11:07 +00:00
|
|
|
|
<?php exit(); endif; ?>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2020-06-23 05:11:07 +00:00
|
|
|
|
<html lang="ru">
|
2018-01-28 16:40:49 +00:00
|
|
|
|
<head>
|
2020-07-03 13:23:08 +00:00
|
|
|
|
<title>Информация о <?= $user->login ?></title>
|
2018-01-29 16:18:56 +00:00
|
|
|
|
<meta charset=UTF-8"/>
|
|
|
|
|
<link href="css/main.css" rel="stylesheet">
|
2018-01-28 16:40:49 +00:00
|
|
|
|
</head>
|
2020-07-03 13:52:19 +00:00
|
|
|
|
<body>
|
2020-07-05 16:44:41 +00:00
|
|
|
|
<?php
|
2020-07-05 07:12:48 +00:00
|
|
|
|
try {
|
2020-07-05 16:46:25 +00:00
|
|
|
|
$effect = db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = ?i ', $user->id, 5)->fetch_assoc();
|
2020-07-03 14:57:40 +00:00
|
|
|
|
if ($effect['time'] && !private_access($uid)) {
|
|
|
|
|
die('<h3>Персонаж обезличен!</h3>');
|
|
|
|
|
}
|
2020-07-05 16:54:57 +00:00
|
|
|
|
} catch (Exception $e_hide_info) {
|
|
|
|
|
echo "<div class='debug'>Ошибка обезличивателя: {$e_hide_info}</div>";
|
2020-07-05 07:12:48 +00:00
|
|
|
|
}
|
2020-07-05 16:43:15 +00:00
|
|
|
|
try {
|
|
|
|
|
$user->showUserInfo();
|
2020-07-05 16:54:57 +00:00
|
|
|
|
} catch (Exception $e_showUserInfo) {
|
|
|
|
|
echo "<div class='debug'>Ошибка генератора showUserInfo() в User.php: {$e_showUserInfo}</div>";
|
2020-07-03 14:14:08 +00:00
|
|
|
|
}
|
2020-07-05 16:43:15 +00:00
|
|
|
|
|
|
|
|
|
include_once 'views/presents-list.php';
|
|
|
|
|
|
2019-01-28 14:53:11 +00:00
|
|
|
|
# Секретный раздел
|
2018-01-28 16:40:49 +00:00
|
|
|
|
# Если я любой паладин, и смотрю не админа, или я сам админ.
|
2020-07-05 17:41:45 +00:00
|
|
|
|
echo sprintf('<div class="debug">uid: %s <br><br> secret: %s <br><br> %s</div>', $uid, private_access($uid), var_dump(private_access($uid)));
|
2020-07-05 17:38:44 +00:00
|
|
|
|
|
2020-07-03 14:14:08 +00:00
|
|
|
|
if ((private_access($uid) === MODERATOR_ACCESS && !$user->admin) || private_access($uid) === ADMINISTRATOR_ACCESS) {
|
2020-07-03 14:51:01 +00:00
|
|
|
|
$ld = db::c()->query('SELECT * FROM users_logs WHERE user_id = ?i ORDER BY `id` ASC', $user->id);
|
2019-01-18 12:25:27 +00:00
|
|
|
|
echo "<H4>Личное дело</H4>";
|
2018-02-16 00:17:47 +00:00
|
|
|
|
while ($row_ld = $ld->fetch_assoc()) {
|
2020-07-03 14:51:01 +00:00
|
|
|
|
$text = date("d.m.Y H:i ", $row_ld['date']) . $row_ld['text'];
|
|
|
|
|
echo "<code>$text</code><br />";
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "<H4>Дополнительные сведения</H4>";
|
2020-07-03 14:14:08 +00:00
|
|
|
|
if (!empty($user->id)) {
|
|
|
|
|
echo "ID: " . $user->id . "<br>";
|
|
|
|
|
}
|
|
|
|
|
if (!empty($user->email)) {
|
|
|
|
|
echo "E-mail: " . $user->email . "<br>";
|
|
|
|
|
}
|
|
|
|
|
if (!empty($user->borndate)) {
|
|
|
|
|
echo "День рождения: " . $user->borndate . "<br>";
|
|
|
|
|
}
|
|
|
|
|
if (!empty($user->ip)) {
|
|
|
|
|
echo "IP при регистрации: " . $user->ip . "<br>";
|
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-03 14:14:08 +00:00
|
|
|
|
if (private_access($uid) === ADMINISTRATOR_ACCESS) {
|
|
|
|
|
if (!empty($user->exp)) {
|
|
|
|
|
echo "Oпыт: " . $user->exp . "<br>";
|
|
|
|
|
}
|
|
|
|
|
if (!empty($user->stats)) {
|
|
|
|
|
echo "Число неиспользованных UP-ов: " . $user->stats . "<br>";
|
|
|
|
|
}
|
|
|
|
|
if (!empty($user->money)) {
|
|
|
|
|
echo "Кредитов: " . $user->money . "<br>";
|
|
|
|
|
}
|
|
|
|
|
if (!empty($user->room)) {
|
|
|
|
|
echo "Комната: " . $user->room . "<br>";
|
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2020-07-03 13:49:39 +00:00
|
|
|
|
echo "<H4>Банковские счета</H4>";
|
|
|
|
|
$bankInfo = new Bank($user->id);
|
2020-07-03 14:14:08 +00:00
|
|
|
|
echo "Счет: " . $bankInfo->user_id . PHP_EOL;
|
|
|
|
|
echo "Деньги на счету: " . $bankInfo->money . PHP_EOL;
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
?>
|
2018-01-29 16:18:56 +00:00
|
|
|
|
|
|
|
|
|
<script src="js/jquery-1.7.2.min.js"></script>
|
|
|
|
|
<script src="js/showthing.js"></script>
|
|
|
|
|
<script>
|
|
|
|
|
$(function () {
|
|
|
|
|
$(".tooltip").tipTip({maxWidth: "auto", edgeOffset: 0, fadeIn: 300, fadeOut: 500});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
</body>
|
|
|
|
|
</html>
|