diff --git a/main.php b/main.php index 46dcaae..8dc7a43 100644 --- a/main.php +++ b/main.php @@ -2,7 +2,7 @@ ob_start("ob_gzhandler"); session_start(); $get = filter_input(INPUT_SERVER, 'QUERY_STRING'); -if ($get === 'exit') { +if ($get == 'exit') { session_destroy(); header("Location: fight.php"); } @@ -50,10 +50,22 @@ while ($row = $data->fetch_assoc()) { } //Обработчики нажатий на кнопки. -if (isset($_POST['battlefield'])) { +if ($_POST['battlefield'] ?? 0) { header('Location: zayavka.php'); exit(); } +if ($_POST['module_quest'] ?? 0) { + header('Location: module_quest.php'); + exit(); +} +if ($_POST['move_inside'] ?? 0 && $user->room == 20) { + header('Location: main.php?goto=arena'); + exit(); +} +if ($_POST['move_outside'] ?? 0 && $user->room != 20) { + header('Location: main.php?goto=plo'); + exit(); +} /* === проверяем соответствие комнаты и скрипта === */ if (in_array($user->room, [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111], 1)) { @@ -202,7 +214,7 @@ function del_efs($id, $type) // одеть предмет function dressitem($id) { - //FIXME Предметы не должны одеваться, если не соответствуют требованиям! + //FIXME bug #7 define('HELMET', 1); define('ARMOR', 2); define('LEGS', 3); @@ -234,7 +246,7 @@ function dressitem($id) if (!$itemInSlotQuantity) { // просто одеваем предмет db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id); - } elseif ($itemInSlotQuantity === 1) { + } elseif ($itemInSlotQuantity == 1) { // снимаем предмет и одеваем вместо db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i', $itemInSlot[0]); db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id); @@ -252,7 +264,7 @@ function dressitem($id) sort($emptyRingSlots); // Одеваем предмет в первый свободный слот. db::c()->query('UPDATE inventory SET dressed_slot = ?i WHERE item_id = ?i', $emptyRingSlots[0], $id); - } elseif ($itemInSlotQuantity === 3) { + } elseif ($itemInSlotQuantity == 3) { db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = 11'); db::c()->query('UPDATE inventory SET dressed_slot = 11 WHERE item_id = ?i', $id); // снимаем предмет из слота 11 и одеваем вместо @@ -292,14 +304,14 @@ if ($goto) { err('У вас тяжелая травма, вы не можете передвигатся...'); $imove = false; } - if ($goto == 'plo' && !$user->zayavka && $imove === true) { - db::c()->query('UPDATE users, online SET users.room = 20, online.room = 20 WHERE online.user_id = users.id AND online.users_id = ?i', $_SESSION['uid']); + if ($goto == 'plo' && !$user->zayavka && $imove == true && $user->room != 20) { + db::c()->query('UPDATE users, online SET users.room = 20, online.room = 20 WHERE online.user_id = users.id AND online.user_id = ?i', $_SESSION['uid']); header('Location: city.php'); exit("Топ-топ-топ..."); } else { err('Подали заявку на бой и убегаете из клуба? Нехорошо...'); } - if ($goto == 'arena' && $user->room === 20 && $imove === true) { + if ($goto == 'arena' && $user->room == 20 && $imove == true) { db::c()->query('UPDATE users, online SET users.room = 1, online.room = 1 WHERE online.user_id = users.id AND online.user_id = ?i', $_SESSION['uid']); header('Location: main.php'); exit("Топ-топ-топ..."); @@ -544,17 +556,11 @@ Template::header('Игра');
- - room === 20): ?> - + + room == 20): ?> + - +