Final: Делаем подарки.

This commit is contained in:
Igor Barkov [iwork] 2019-01-28 19:56:21 +02:00
parent 1a5a33537b
commit 4480a432a5

36
inf.php
View File

@ -3,20 +3,19 @@ session_start();
require_once 'functions.php'; require_once 'functions.php';
$login = urldecode(filter_input(INPUT_SERVER, 'QUERY_STRING')); $login = urldecode(filter_input(INPUT_SERVER, 'QUERY_STRING'));
$uid = isset($_SESSION['uid']) ? $_SESSION['uid'] : NULL; $uid = isset($_SESSION['uid']) ? $_SESSION['uid'] : null;
$user = db::c()->query('SELECT `id`,`login`,`married`,`win`,borndate,`align`,`admin`,`realname`,`info`,`prof1`,`prof2`,`email`,`ip`,`exp`,`stats`,`money`,`room`,`doblest` $user = db::c()->query('SELECT `id`,`login`,`married`,`win`,borndate,`align`,`admin`,`realname`,`info`,`prof1`,`prof2`,`email`,`ip`,`exp`,`stats`,`money`,`room`,`doblest`
FROM `users` FROM `users`
WHERE `login` = "?s" OR `id` = "?s"', $login, $login)->fetch_assoc(); WHERE `login` = "?s" OR `id` = "?s"', $login, $login)->fetch_assoc();
$own = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = "?s"', $uid)->fetch_assoc(); $own = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = "?s"', $uid)->fetch_assoc();
$presents = db::c()->query('SELECT img, sender FROM `users_presents` WHERE expiration_date >= "?s" AND owner = ?i', date('Y-m-d'), $user['id']);
$presents = db::c()->query('SELECT `img`,`present` FROM `inventory` WHERE type = 200 AND `present`<>"?s" AND `owner` = ?i', '', $user['id']);
$presents_new = db::c()->query('SELECT img, sender FROM `users_presents` WHERE owner = ?i',$user['id']);
if (empty($user['id'])): ?> if (empty($user['id'])): ?>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Ошибка</title></head> <title>Ошибка</title>
</head>
<body style="color: #666; background-color: #d5d5d5; text-align: center; font-family: Consolas,monospace;"> <body style="color: #666; background-color: #d5d5d5; text-align: center; font-family: Consolas,monospace;">
Ошибка: персонаж<?= ($login ? "&nbsp;<em>" . $login . "</em>" : ""); ?> не найден... Ошибка: персонаж<?= ($login ? "&nbsp;<em>" . $login . "</em>" : ""); ?> не найден...
<p><a style="color: #99f" href="javascript:window.history.go(-1);">←назад</a></p> <p><a style="color: #99f" href="javascript:window.history.go(-1);">←назад</a></p>
@ -29,7 +28,6 @@ if (empty($user['id'])): ?>
<title>Информация о <?= $user['login'] ?></title> <title>Информация о <?= $user['login'] ?></title>
<meta charset=UTF-8"/> <meta charset=UTF-8"/>
<link href="css/main.css" rel="stylesheet"> <link href="css/main.css" rel="stylesheet">
<link href="css/tooltip.css" rel="stylesheet">
</head> </head>
<BODY onload="<?= topsethp() ?>"> <BODY onload="<?= topsethp() ?>">
<?php if ($user['admin'] == 1 AND $own['admin'] != 1 AND file_exists('customuserdata/' . $user['id'])) die(file_get_contents('customuserdata/' . $user['id'])); ?> <?php if ($user['admin'] == 1 AND $own['admin'] != 1 AND file_exists('customuserdata/' . $user['id'])) die(file_get_contents('customuserdata/' . $user['id'])); ?>
@ -37,10 +35,10 @@ if (empty($user['id'])): ?>
<tr> <tr>
<td style="width: 250px; vertical-align: top;"> <td style="width: 250px; vertical-align: top;">
<?= showinf_pers($user['id']); <?= showinf_pers($user['id']);
if (!empty($user['married'])): ?>
if (!empty($user['married'])) <a href="inf.php?<?= $user['married'] ?>" target=_blank><img src="i/married.gif"
echo '<br><a href="inf.php?' . $user['married'] . '" target=_blank><img src="i/married.gif" class="tooltip" title="В браке с ' . $user['married'] . '"></a>'; title="В браке с <?= $user['married'] ?>"></a>";
?> <?php endif; ?>
</td> </td>
<td style="vertical-align: top; width: 100px; text-align: center;"> <td style="vertical-align: top; width: 100px; text-align: center;">
<img src="i/zodiac/<?= star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)); ?>.png"> <img src="i/zodiac/<?= star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)); ?>.png">
@ -60,16 +58,7 @@ if (!empty($user['realname'])) echo "Имя: " . $user['realname'] . "<br>";
<div> <div>
<legend>Подарки</legend> <legend>Подарки</legend>
<?php <?php
while ($row = $presents->fetch_assoc()) while ($row = $presents->fetch_assoc()): ?>
echo "<img src=i/sh/{$row['img']} class='tooltip' title='Подарок от {$row['present']}'>";
?>
</div>
<?php endif; ?>
<?php if ($presents_new->getNumRows()): ?>
<div>
<legend>Подарки+</legend>
<?php
while ($row = $presents_new->fetch_assoc()): ?>
<img src="<?= $row['img'] ?>" title="<?= $row['sender'] ?>" alt="<?= $row['sender'] ?>"> <img src="<?= $row['img'] ?>" title="<?= $row['sender'] ?>" alt="<?= $row['sender'] ?>">
<?php endwhile; ?> <?php endwhile; ?>
</div> </div>
@ -78,9 +67,9 @@ if (!empty($user['realname'])) echo "Имя: " . $user['realname'] . "<br>";
<div> <div>
<legend>Лицензии</legend> <legend>Лицензии</legend>
<?php <?php
if ($user['prof2'] == 21) echo ' <img src="i/prof21.png" class="tooltip" title="Лицензия наемника"> '; if ($user['prof2'] == 21) echo ' <img src="i/prof21.png" title="Лицензия наемника"> ';
if ($user['prof2'] == 22) echo ' <img src="i/prof22.png" class="tooltip" title="Лицензия лекаря"> '; if ($user['prof2'] == 22) echo ' <img src="i/prof22.png" title="Лицензия лекаря"> ';
if ($user['prof1'] == 1) echo ' <img src="i/prof1.png" class="tooltip" title="Лицензия кузнеца"> '; if ($user['prof1'] == 1) echo ' <img src="i/prof1.png" title="Лицензия кузнеца"> ';
?> ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -132,7 +121,6 @@ if ($own['admin'] == 1) {
<script src="js/jquery-1.7.2.min.js"></script> <script src="js/jquery-1.7.2.min.js"></script>
<script src="js/showthing.js"></script> <script src="js/showthing.js"></script>
<script src="js/tooltip.js"></script>
<script> <script>
$(function () { $(function () {
$(".tooltip").tipTip({maxWidth: "auto", edgeOffset: 0, fadeIn: 300, fadeOut: 500}); $(".tooltip").tipTip({maxWidth: "auto", edgeOffset: 0, fadeIn: 300, fadeOut: 500});