Отказ от алиаса die в пользу exit, более явная проверка на наличие сессии. Некоторые проверки входа теперь проверяют объекты, а не массив.
This commit is contained in:
54
cave.php
54
cave.php
@@ -207,11 +207,11 @@ function redirectbyroom($r)
|
||||
{
|
||||
if (in_array($r, Config::$canalenters)) {
|
||||
header("location: enter_cave.php");
|
||||
die();
|
||||
exit;
|
||||
}
|
||||
if ($r == 1) {
|
||||
header("location: main.php");
|
||||
die();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ if ($user["login"] == "Rallo Tabs") {
|
||||
|
||||
if ($user['battle'] > 0) {
|
||||
header("location: fbattle.php");
|
||||
die();
|
||||
exit;
|
||||
}
|
||||
|
||||
$objsizes = [0 => [0, 0], 1 => [120, 60], 2 => [120, 60], 3 => [120, 60], 4 => [110, 72], 5 => [120, 120]];
|
||||
@@ -288,15 +288,15 @@ function makedeath()
|
||||
{
|
||||
global $user, $floor, $loses, $x, $y, $dir;
|
||||
$cavedata = Config::$cavedata ?? [];
|
||||
if (!isset($cavedata[$user['room']]['x' . $floor])) {
|
||||
if (!isset($cavedata[$user->room]['x' . $floor])) {
|
||||
$floor = 1;
|
||||
loadmap();
|
||||
}
|
||||
mysql_query("UPDATE `caveparties` SET `floor` = $floor, `x` = '" . $cavedata[$user['room']]['x' . $floor] . "', `y` = '" . $cavedata[$user['room']]['y' . $floor] . "', `dir` = '" . $cavedata[$user['room']]['dir' . $floor] . "', `loses` = (`loses`+1) WHERE `user` = '$user[id]' LIMIT 1");
|
||||
mysql_query("UPDATE `caveparties` SET `floor` = $floor, `x` = '" . $cavedata[$user->room]['x' . $floor] . "', `y` = '" . $cavedata[$user->room]['y' . $floor] . "', `dir` = '" . $cavedata[$user->room]['dir' . $floor] . "', `loses` = (`loses`+1) WHERE `user` = '$user[id]' LIMIT 1");
|
||||
mysql_query('UPDATE `users` SET `hp` = 1 WHERE `id` = "' . $user['id'] . '" LIMIT 1');
|
||||
$x = $cavedata[$user['room']]['x' . $floor];
|
||||
$y = $cavedata[$user['room']]['y' . $floor];
|
||||
$dir = $cavedata[$user['room']]['dir' . $floor];
|
||||
$x = $cavedata[$user->room]['x' . $floor];
|
||||
$y = $cavedata[$user->room]['y' . $floor];
|
||||
$dir = $cavedata[$user->room]['dir' . $floor];
|
||||
updparties();
|
||||
$loses++;
|
||||
}
|
||||
@@ -447,9 +447,9 @@ function getcavedata($caveleader, $floor)
|
||||
return unserialize(implode("", file("cavedata/$caveleader-$floor.dat")));
|
||||
}
|
||||
|
||||
if (!in_array($user['room'], Config::$caverooms)) {
|
||||
if (!in_array($user->room, Config::$caverooms)) {
|
||||
header("Location: main.php");
|
||||
die('Not in this life ...');
|
||||
exit('Not in this life ...');
|
||||
}
|
||||
|
||||
if (isset($_GET['direction'])) {
|
||||
@@ -472,7 +472,7 @@ while ($rec = mysql_fetch_assoc($r)) {
|
||||
$party[] = $rec;
|
||||
}
|
||||
|
||||
if ($user['room'] == 621) {
|
||||
if ($user->room == 621) {
|
||||
$base = "/underdesigns/alchcave";
|
||||
}
|
||||
|
||||
@@ -553,8 +553,8 @@ if (@$_GET['useitem']) {
|
||||
$ty = $y + 1;
|
||||
}
|
||||
if (@$_GET['useitem']) {
|
||||
if (file_exists("underground/objects/$user[room].php")) {
|
||||
include "underground/objects/$user[room].php";
|
||||
if (file_exists("underground/objects/$user->room.php")) {
|
||||
include "underground/objects/$user->room.php";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,7 +650,7 @@ if ($wander && !isset($_GET['attack'])) {
|
||||
$ty = $v['y'] + 2;
|
||||
}
|
||||
|
||||
if ($user['room'] == 74 || $user['room'] == 76) {
|
||||
if ($user->room == 74 || $user->room == 76) {
|
||||
if (strpos($map[$ty][$tx], 's/') !== false && !@$mapbots[$ty][$tx]) {
|
||||
break;
|
||||
}
|
||||
@@ -718,8 +718,8 @@ if ($moved && (substr($map[$y * 2][$x * 2], 0, 1) === "e" || substr($map[$y * 2]
|
||||
$tx = $x;
|
||||
$ty = $y;
|
||||
$tmp = explode("/", $map[$y * 2][$x * 2]);
|
||||
if (file_exists("underground/events/$user[room].php")) {
|
||||
include("underground/events/$user[room].php");
|
||||
if (file_exists("underground/events/$user->room.php")) {
|
||||
include("underground/events/$user->room.php");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -744,7 +744,7 @@ if ($ambushes[$y * 2][$x * 2 - 2] && $map[$y * 2][$x * 2 - 1] == 0) {
|
||||
|
||||
if ($ax && $ay && $user['hp'] > 0) {
|
||||
$cavedata = Config::$cavedata ?? [];
|
||||
if (!($cavedata[$user['room']]['x' . $floor] == $x && $cavedata[$user['room']]['y' . $floor] == $y)) {
|
||||
if (!($cavedata[$user->room]['x' . $floor] == $x && $cavedata[$user->room]['y' . $floor] == $y)) {
|
||||
if ($ax < $x) {
|
||||
$dir1 = 0;
|
||||
} elseif ($ax > $x) {
|
||||
@@ -818,12 +818,12 @@ if (@$_GET['speak']) {
|
||||
$tmp = explode("/", $cell);
|
||||
if ($tmp[0] == "d") {
|
||||
header("location: dialog.php?char=$tmp[2]");
|
||||
die();
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($tmp[0] == "b" && isset($dialogs[CaveBots::$bots[$tmp[1]]])) {
|
||||
header("location: dialog.php?char=" . CaveBots::$bots[$tmp[1]]);
|
||||
die();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -908,7 +908,7 @@ if (@$_GET['exit']) {
|
||||
}
|
||||
}
|
||||
mysql_query("DELETE FROM `inventory` WHERE `owner` = '$user[id]' AND `foronetrip` = 1");
|
||||
gotoroom($user['room'] - 1);
|
||||
gotoroom($user->room - 1);
|
||||
}
|
||||
|
||||
$standingon = $map[$y * 2][$x * 2];
|
||||
@@ -1517,9 +1517,9 @@ function drawmap($map1, $players, $x, $y, $direction)
|
||||
$ret .= drawobject2($aMap[$yy][$xx], $x, $y);
|
||||
}
|
||||
|
||||
$rrm = $user['room'];
|
||||
$rrm = $user->room;
|
||||
|
||||
if (isset($dialogs[CaveBots::$bots[$data[1]]]) && (CaveBots::$bots[$data[1]] == 11147 && $user['room'] == 74)) {
|
||||
if (isset($dialogs[CaveBots::$bots[$data[1]]]) && (CaveBots::$bots[$data[1]] == 11147 && $user->room == 74)) {
|
||||
$ret .= "<img title=\"$botname" . ($cnt > 1 ? " ($cnt)" : "") . "\" " . ($y == 1 && $x == 3 ? "onclick=\"speakattackmenu(event);\"" : "") . " width=\"" . $imgdata[$x][$y]["wd"] . "\" height=\"" . $imgdata[$x][$y]["ht"] . "\" src=\"/i/dungeon/mobs/$rrm/$bot.gif\" style=\"position: absolute; left: " . $imgdata[$x][$y]["x"][$bn] . "px; top: " . $imgdata[$x][$y]["y"] . "px;" . ($x == 3 && $y == 1 ? "cursor: pointer;" : "") . ($x == 3 ? "z-index: " . (99 - ($y * 5)) . ";" : "") . "\" />";
|
||||
} else {
|
||||
$ret .= "<img title=\"$botname" . ($cnt > 1 ? " ($cnt)" : "") . "\" " . ($y == 1 && $x == 3 ? " onclick=\"document.location.href='cave.php?attack=1';\"" : "") . " width=\"" . $imgdata[$x][$y]["wd"] . "\" height=\"" . $imgdata[$x][$y]["ht"] . "\" src=\"/i/dungeon/mobs/$rrm/$bot.gif\" style=\"position: absolute; left: " . $imgdata[$x][$y]["x"][$bn] . "px; top: " . $imgdata[$x][$y]["y"] . "px;" . ($x == 3 && $y == 1 ? "cursor: pointer;" : "") . ($x == 3 ? "z-index: " . (99 - ($y * 5)) . ";" : "") . "\" />";
|
||||
@@ -1609,7 +1609,7 @@ function drawmap($map1, $players, $x, $y, $direction)
|
||||
$left = $imgdata[$x][$y]["x"][1];
|
||||
$top = $imgdata[$x][$y]["y"] + $ht;
|
||||
}
|
||||
$rrm = $user['room'];
|
||||
$rrm = $user->room;
|
||||
if (!isset($imgmap[$obj])) {
|
||||
|
||||
$ret .= "
|
||||
@@ -1654,7 +1654,7 @@ function drawmap($map1, $players, $x, $y, $direction)
|
||||
$left = $imgdata[$x][$y]["x"][1];
|
||||
$top = $imgdata[$x][$y]["y"] + $ht;
|
||||
}
|
||||
$rrm = $user['room'];
|
||||
$rrm = $user->room;
|
||||
if (!isset($imgmap[$obj])) {
|
||||
$ret .= "
|
||||
" . ($y == 1 && $x == 3 ? "<a href=\"cave.php?useitem=1\">" : "") . "
|
||||
@@ -1815,7 +1815,7 @@ function drawmap($map1, $players, $x, $y, $direction)
|
||||
}
|
||||
$objInWall = explode('/', $map[3][$wall]);
|
||||
if ($objInWall[1] == "o") {
|
||||
if ($user['room'] == 83 && !(!$direction && (($x == 13 && $y == 4) || ($x == 12 && $y == 4)))) { // исключение 2-ух клеток в комнате 82
|
||||
if ($user->room == 83 && !(!$direction && (($x == 13 && $y == 4) || ($x == 12 && $y == 4)))) { // исключение 2-ух клеток в комнате 82
|
||||
$ret .= drawobject('//' . $objInWall[2], 3, $i);
|
||||
}
|
||||
}
|
||||
@@ -2038,10 +2038,10 @@ progress_update();
|
||||
<td width=540>
|
||||
<div style="text-align:right;padding-right:30px">
|
||||
<font style='font-size:14px; color:#8f0000'><b><?
|
||||
$dMap = unserialize(mysql_result(mysql_query("SELECT `map` FROM `cavemaps` WHERE `floor` = $floor AND `room` = " . ($user['room'] - 1)), 0, 0));
|
||||
$dMap = unserialize(mysql_result(mysql_query("SELECT `map` FROM `cavemaps` WHERE `floor` = $floor AND `room` = " . ($user->room - 1)), 0, 0));
|
||||
$cPlace = $dMap[$y * 2][$x * 2];
|
||||
$tmp = explode("/", $cPlace);
|
||||
if ($user['room'] == 621) {
|
||||
if ($user->room == 621) {
|
||||
if ($floor == 1) {
|
||||
echo 'Проклятый Рудник, 1 этаж';
|
||||
} elseif ($floor == 2) {
|
||||
|
||||
Reference in New Issue
Block a user