Черновой готовый файл.
This commit is contained in:
parent
7f495cb38d
commit
c49db37d3c
213
c_forest.php
213
c_forest.php
@ -1,120 +1,141 @@
|
||||
<?
|
||||
session_start();
|
||||
if(!isset($_SESSION['uid'])) { header('Location: index.php'); exit(); }
|
||||
include('config.php');
|
||||
include('functions.php');
|
||||
if($user['room'] == 51) { header('location: city.php'); die(); }
|
||||
require_once('functions.php');
|
||||
if (!isset($_SESSION['uid'])) {
|
||||
header('Location: index.php');
|
||||
die();
|
||||
}
|
||||
if ($user['room'] == 51) {
|
||||
header('location: city.php');
|
||||
die();
|
||||
}
|
||||
$forest = db::c()->query('SELECT `id`, `room`, `room_id`, `time`, `user`, `data` FROM `forest` WHERE `user` = ?i', $user['id'])->fetch_assoc();
|
||||
$error = '';
|
||||
$map_page = '';
|
||||
|
||||
$forest = mysql_fetch_array(mysql_query('SELECT `id`, `room`, `room_id`, `time`, `user`, `data` FROM `forest` WHERE `user` = "'.$user['id'].'" LIMIT 1'));
|
||||
if(!isset($forest['id'])) {
|
||||
die('Ошибка. Сообщите Администрации. Код ошибки : 00.');
|
||||
if (empty($forest['id'])) {
|
||||
die('Ошибка. Сообщите Администрации. Код ошибки : 00.');
|
||||
}
|
||||
|
||||
function loadmap_cell() {
|
||||
global $forest;
|
||||
$dat = unserialize($forest['data']);
|
||||
$dat = array('Up' => $dat[$forest['room']]['Up'], 'Down' => $dat[$forest['room']]['Down'], 'Left' => $dat[$forest['room']]['Left'], 'Right' => $dat[$forest['room']]['Right']);
|
||||
return $dat;
|
||||
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;
|
||||
}
|
||||
|
||||
$map_user = loadmap_cell();
|
||||
|
||||
|
||||
if($_GET['exit_forest'] == 'true') {
|
||||
if($forest['room']) {
|
||||
#mysql_query('DELETE FROM `forest_bots` WHERE `user` = "'.$user['id'].'" AND `group` = "'.$forest['id'].'"');
|
||||
#mysql_query('DELETE FROM `forest_items` WHERE `user` = "'.$user['id'].'" AND `group` = "'.$forest['id'].'"');
|
||||
mysql_query('DELETE FROM `forest` WHERE `user` = "'.$user['id'].'" LIMIT 1');
|
||||
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '51', `online`.`room` = '51' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '".$user['id']."'");
|
||||
unset($forest);
|
||||
} else {
|
||||
$error = 'Выхода тут нет ...';
|
||||
}
|
||||
if ($_GET['exit_forest'] == 'true') {
|
||||
if ($forest['room']) {
|
||||
#db::c()->query('DELETE FROM `forest_bots` WHERE `user` = ?i AND `group` = ?i', $user['id'], $forest['id']);
|
||||
#db::c()->query('DELETE FROM `forest_items` WHERE `user` = ?i AND `group` = ?i', $user['id'], $forest['id']);
|
||||
db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 51, `online`.`room` = 51 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $user['id']);
|
||||
db::c()->query('DELETE FROM `forest` WHERE `user` = ?i', $user['id']);
|
||||
unset($forest);
|
||||
} else {
|
||||
$error = 'Выхода тут нет ...';
|
||||
}
|
||||
}
|
||||
|
||||
echo $map_user['Down'].' = '.$map_user['Right'];
|
||||
echo $map_user['Down'] . ' = ' . $map_user['Right'];
|
||||
|
||||
if($_GET['move'] == 'true') {
|
||||
if($_GET['Dir'] == 'Up') {
|
||||
if($map_user['Up'] == 1) {
|
||||
mysql_query('UPDATE `forest` SET `room` = "cell_'.($forest['room_id']-5).'", `room_id` = "'.($forest['room_id']-5).'" WHERE `id` = "'.$forest['id'].'" LIMIT 1');
|
||||
$forest['room'] = 'cell_'.($forest['room_id']-5); $forest['room_id'] = $forest['room_id']-5;
|
||||
if ($_GET['move'] == 'true') {
|
||||
if ($_GET['Dir'] == 'Up') {
|
||||
if ($map_user['Up'] == 1) {
|
||||
$forest['room'] = 'cell_' . ($forest['room_id'] - 5);
|
||||
$forest['room_id'] = $forest['room_id'] - 5;
|
||||
} else {
|
||||
$error = 'Ошибка. Сообщите Администрации. Код ошибки : 01.';
|
||||
}
|
||||
} elseif ($_GET['Dir'] == 'Down') {
|
||||
if ($map_user['Down'] == 1) {
|
||||
$forest['room'] = 'cell_' . ($forest['room_id'] + 5);
|
||||
$forest['room_id'] = $forest['room_id'] + 5;
|
||||
} else {
|
||||
$error = 'Ошибка. Сообщите Администрации. Код ошибки : 02.';
|
||||
}
|
||||
} elseif ($_GET['Dir'] == 'Left') {
|
||||
if ($map_user['Left'] == 1) {
|
||||
$forest['room'] = 'cell_' . ($forest['room_id'] - 1);
|
||||
$forest['room_id'] = $forest['room_id'] - 1;
|
||||
} else {
|
||||
$error = 'Ошибка. Сообщите Администрации. Код ошибки : 03.';
|
||||
}
|
||||
} elseif ($_GET['Dir'] == 'Right') {
|
||||
if ($map_user['Right'] == 1) {
|
||||
$forest['room'] = 'cell_' . ($forest['room_id'] + 1);
|
||||
$forest['room_id'] = $forest['room_id'] + 1;
|
||||
} else {
|
||||
$error = 'Ошибка. Сообщите Администрации. Код ошибки : 04.';
|
||||
}
|
||||
} else {
|
||||
$error = 'Ошибка. Сообщите Администрации. Код ошибки : 01.';
|
||||
$error = 'Not in this life';
|
||||
}
|
||||
} elseif($_GET['Dir'] == 'Down') {
|
||||
if($map_user['Down'] == 1) {
|
||||
mysql_query('UPDATE `forest` SET `room` = "cell_'.($forest['room_id']+5).'", `room_id` = "'.($forest['room_id']+5).'" WHERE `id` = "'.$forest['id'].'" LIMIT 1');
|
||||
$forest['room'] = 'cell_'.($forest['room_id']+5); $forest['room_id'] = $forest['room_id']+5;
|
||||
} else {
|
||||
$error = 'Ошибка. Сообщите Администрации. Код ошибки : 02.';
|
||||
}
|
||||
} elseif($_GET['Dir'] == 'Left') {
|
||||
if($map_user['Left'] == 1) {
|
||||
$forest['room'] = 'cell_'.($forest['room_id']-1); $forest['room_id'] = $forest['room_id']-1;
|
||||
mysql_query('UPDATE `forest` SET `room` = "'.$forest['room'].'", `room_id` = "'.$forest['room_id'].'" WHERE `id` = "'.$forest['id'].'" LIMIT 1');
|
||||
} else {
|
||||
$error = 'Ошибка. Сообщите Администрации. Код ошибки : 03.';
|
||||
}
|
||||
} elseif($_GET['Dir'] == 'Right') {
|
||||
if($map_user['Right'] == 1) {
|
||||
$forest['room'] = 'cell_'.($forest['room_id']+1); $forest['room_id'] = $forest['room_id']+1;
|
||||
mysql_query('UPDATE `forest` SET `room` = "'.$forest['room'].'", `room_id` = "'.$forest['room_id'].'" WHERE `id` = "'.$forest['id'].'" LIMIT 1');
|
||||
} else {
|
||||
$error = 'Ошибка. Сообщите Администрации. Код ошибки : 04.';
|
||||
}
|
||||
} 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 ($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';"/>
|
||||
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';"/>
|
||||
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';"/>
|
||||
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';"/>
|
||||
MAP;
|
||||
?>
|
||||
<html>
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<title>404</title>
|
||||
<script src="js/jquery-1.7.2.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="css/hostel.css" />
|
||||
<style>
|
||||
.bt {
|
||||
border: solid 1px #b0b0b0;
|
||||
margin-top: 1px;
|
||||
margin-bottom: 2px;
|
||||
font-size: 11px;
|
||||
color: #191970;
|
||||
float: right;
|
||||
margin-right: 18px;
|
||||
}
|
||||
</style>
|
||||
<title>forest</title>
|
||||
<script src="js/jquery-1.7.2.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="css/hostel.css"/>
|
||||
<style>
|
||||
.bt {
|
||||
border: solid 1px #b0b0b0;
|
||||
margin-top: 1px;
|
||||
margin-bottom: 2px;
|
||||
font-size: 11px;
|
||||
color: #191970;
|
||||
float: right;
|
||||
margin-right: 18px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="ajaxContainer" style="display: none;"></div>
|
||||
<div class="contentContainer">
|
||||
<div class="buttonContainer">
|
||||
<input type="button" class="bt" value="Обновить" onclick="location.href='c_forest.php';" />
|
||||
<input type="button" class="bt" value="Выйти из лесу" onclick="location.href='c_forest.php?exit_forest=true';" />
|
||||
<div style="float: left;padding-left: 50px;">
|
||||
<span id="hpKey_378332" class="hpContainer hpContainer-g">
|
||||
<img src="/i/herz.gif" width="10" height="10" alt="Уровень жизни" />
|
||||
<img src="/i/1green.gif" width="122" height="10" alt="Уровень жизни" />
|
||||
<img src="/i/1silver.gif" width="0" height="10" alt="уровень жизни" />: 300/300
|
||||
</span>
|
||||
<div class="buttonContainer">
|
||||
<input type="button" class="bt" value="Обновить" onclick="location.href='c_forest.php';"/>
|
||||
<input type="button" class="bt" value="Выйти из лесу" onclick="location.href='c_forest.php?exit_forest=true';"/>
|
||||
<div style="float: left;padding-left: 50px;">
|
||||
<span id="hpKey_378332" class="hpContainer hpContainer-g">
|
||||
<img src="/i/herz.gif" width="10" height="10" alt="Уровень жизни"/>
|
||||
<img src="/i/1green.gif" width="122" height="10" alt="Уровень жизни"/>
|
||||
<img src="/i/1silver.gif" width="0" height="10" alt="уровень жизни"/>: 300/300
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="systemMsg" class="system-msg">
|
||||
<?php if (!empty($error)): ?>
|
||||
<b style='color: Red;'>' . $error . '</b>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div style="position: relative; width: 780px; height: 350px; background-image: url('forest/<?= $forest['room'] ?>.jpg');">
|
||||
<?= $map_page ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="systemMsg" class="system-msg"></div>
|
||||
<div style="position: relative; width: 780px; height: 350px; background-image: url('forest/<?=$forest['room'];?>.jpg');">
|
||||
<? if($map_user['Right'] == 1) { ?>
|
||||
<img style="position: absolute; bottom: 30px; left: 740px; cursor: pointer; width: 20px; height: 117px; border: 0 solid blue;" class="pngimg" src="i/forest/pointer_2.png" title="<?=$var_map['cell_'.($forest['room_id']+1)];?>" onclick="location.href='?move=true&Dir=Right';" />
|
||||
<? } ?>
|
||||
<? if($map_user['Left'] == 1) { ?>
|
||||
<img style="position: absolute; bottom: 30px; left: 20px; cursor: pointer; width: 20px; height: 117px; border: 0 solid blue;" class="pngimg" src="i/forest/pointer_6.png" title="<?=$var_map['cell_'.($forest['room_id']-1)];?>" onclick="location.href='?move=true&Dir=Left';" />
|
||||
<? } ?>
|
||||
<? if($map_user['Down'] == 1) { ?>
|
||||
<img style="position: absolute; bottom: 10px; left: 332px; cursor: pointer; width: 117px; height: 20px; border: 0 solid blue;" class="pngimg" src="i/forest/pointer_4.png" title="<?=$var_map['cell_'.($forest['room_id']+5)];?>" onclick="location.href='?move=true&Dir=Down';" />
|
||||
<? } ?>
|
||||
<? if($map_user['Up'] == 1) { ?>
|
||||
<img style="position: absolute; bottom: 127px; left: 332px; cursor: pointer; width: 117px; height: 20px; border: 0 solid blue;" class="pngimg" src="i/forest/pointer_8.png" title="<?=$var_map['cell_'.($forest['room_id']-5)];?>" onclick="location.href='?move=true&Dir=Up';" />
|
||||
<? } ?>
|
||||
</div>
|
||||
<? if($error != '') { echo '<center><b style=\'color: Red;\'>'.$error.'</b></center>'; } ?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user