Прикручиваем шаблон. Хороним идиотские ошибки.

This commit is contained in:
Igor Barkov (iwork)
2020-09-30 15:58:44 +03:00
parent 733d1cf87b
commit 2f723e02b8
22 changed files with 44 additions and 42 deletions
+23 -21
View File
@@ -1,7 +1,7 @@
<?
session_start();
require_once('functions.php');
if (!isset($_SESSION['uid'])) {
if (empty($_SESSION['uid'])) {
header('Location: index.php');
exit;
}
@@ -21,8 +21,7 @@ function loadmap_cell()
{
global $forest;
$dat = unserialize($forest['data']);
$dat = ['Up' => $dat[$forest['room']]['Up'], 'Down' => $dat[$forest['room']]['Down'], 'Left' => $dat[$forest['room']]['Left'], 'Right' => $dat[$forest['room']]['Right']];
return $dat;
return ['Up' => $dat[$forest['room']]['Up'], 'Down' => $dat[$forest['room']]['Down'], 'Left' => $dat[$forest['room']]['Left'], 'Right' => $dat[$forest['room']]['Right']];
}
$map_user = loadmap_cell();
@@ -73,33 +72,40 @@ if ($_GET['move'] == 'true') {
} else {
$error = 'Not in this life';
}
if (empty($error)) db::c()->query('UPDATE `forest` SET `room` = "?s", `room_id` = ?i WHERE `id` = ?i', $forest['room'], $forest['room_id'], $forest['id']);
if (empty($error)) {
db::c()->query('UPDATE `forest` SET `room` = "?s", `room_id` = ?i WHERE `id` = ?i', $forest['room'], $forest['room_id'], $forest['id']);
}
}
if ($map_user['Right'] == 1) $map_page = <<<MAP
if ($map_user['Right'] == 1) {
$map_page = <<<MAP
<img style="position: absolute; bottom: 30px; left: 740px; cursor: pointer; width: 20px; height: 117px;"
class="pngimg" src="i/forest/pointer_2.png" title="{$var_map['cell_' . ($forest['room_id'] + 1)]}"
onclick="location.href='?move=true&Dir=Right';"/>
onclick="location.href='?move=true&Dir=Right';" alt="Вправо">
MAP;
if ($map_user['Left'] == 1) $map_page = <<<MAP
}
if ($map_user['Left'] == 1) {
$map_page = <<<MAP
<img style="position: absolute; bottom: 30px; left: 20px; cursor: pointer; width: 20px; height: 117px; "
class="pngimg" src="i/forest/pointer_6.png" title="{$var_map['cell_' . ($forest['room_id'] - 1)]}"
onclick="location.href='?move=true&Dir=Left';"/>
onclick="location.href='?move=true&Dir=Left';" alt="Влево">
MAP;
if ($map_user['Down'] == 1) $map_page = <<<MAP
}
if ($map_user['Down'] == 1) {
$map_page = <<<MAP
<img style="position: absolute; bottom: 10px; left: 332px; cursor: pointer; width: 117px; height: 20px;"
class="pngimg" src="i/forest/pointer_4.png" title="{$var_map['cell_' . ($forest['room_id'] + 5)]}"
onclick="location.href='?move=true&Dir=Down';"/>
onclick="location.href='?move=true&Dir=Down';" alt="Вниз">
MAP;
if ($map_user['Up'] == 1) $map_page = <<<MAP
}
if ($map_user['Up'] == 1) {
$map_page = <<<MAP
<img style="position: absolute; bottom: 30px; left: 740px; cursor: pointer; width: 117px; height: 20px;"
class="pngimg" src="i/forest/pointer_8.png" title="{$var_map['cell_' . ($forest['room_id'] + 5)]}"
onclick="location.href='?move=true&Dir=Up';"/>
onclick="location.href='?move=true&Dir=Up';" alt="Вверх">
MAP;
}
Template::header('forest');
?>
<!doctype html>
<html lang="ru">
<head>
<title>forest</title>
<link rel="stylesheet" type="text/css" href="css/hostel.css"/>
<style>
.bt {
@@ -112,8 +118,6 @@ MAP;
margin-right: 18px;
}
</style>
</head>
<body>
<div id="ajaxContainer" style="display: none;"></div>
<div class="contentContainer">
<div class="buttonContainer">
@@ -135,6 +139,4 @@ MAP;
<div style="position: relative; width: 780px; height: 350px; background-image: url('forest/<?= $forest['room'] ?>.jpg');">
<?= $map_page ?>
</div>
</div>
</body>
</html>
</div>