battle) { header('location: fbattle.php'); exit; } function secs2hrs($s, $short = 0) { if ($s < 60) { return "$s сек."; } $retstr = ''; if ($s < 3600) { $min = floor($s / 60); if ($min || !$short) { $retstr .= "$min мин. "; } $sec = $s % 60; if ($sec || !$short) { $retstr .= "$sec сек."; } return $retstr; } $ret = floor($s / 3600); $s = $s % 3600; $d = floor($ret / 24); $h = $ret % 24; if ($d && ($d > 1 || $h || $s)) { $retstr .= "$d д. "; if ($h || !$short) { $retstr .= "$h ч. "; } $min = floor($s / 60); if ($min || !$short) { $retstr .= "$min мин."; } return $retstr; } elseif ($d) { $h += $d * 24; } if ($h) { $retstr = "$h ч. "; $min = floor($s / 60); if ($min || !$short) { $retstr .= "$min мин."; } return $retstr; } return floor($s / 60) . " мин. " . ($s % 60) . " сек."; } if ($_GET['ext'] == 1) { $yas = mysql_fetch_array(mysql_query("SELECT `id` FROM `vxodd` WHERE `login` = '$user[login]' LIMIT 1")); $yad = mysql_fetch_array(mysql_query("SELECT `id` FROM `vxod` WHERE `login` = '$user[login]' LIMIT 1")); if (isset($yas['id']) || isset($yad['id'])) { echo "Подали заявку и убегаем? Не хорошо..."; } else { mysql_query("UPDATE `users`,`online` SET `users`.`room` = '2111', `online`.`room` = '2111' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;"); header('location: main.php'); } } if (in_array($user->room, Config::$canalenters)) { $podzemroom = $user->room + 1; $cavedata = [620 => ['x1' => 3, 'y1' => 2, 'dir1' => 2]]; $podzemdata = [621 => ['name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']]; ?> 1) { echo "$_GET[warning]"; } ?>

0 LIMIT 1"); if ($el = mysql_fetch_array($select)) { $wait_sec = $el['time']; $new_t = time(); $left_time = $wait_sec - $new_t; $left_min = floor($left_time / 60); $left_sec = $left_time - $left_min * 60; if (($user['align'] == '2.99') && $wait_sec > $new_t) { $wait_sec = 1; mysql_query("UPDATE `visit_podzem` SET `time` = 1 WHERE `login` = '$user[login]' AND `time` > 0 AND `room` = '$user->room' LIMIT 1"); } if ($wait_sec > $new_t) { if ($_GET['donate']) { if ($user['money'] >= $podzemdata[$podzemroom]['passprice']) { mysql_query("UPDATE `users` SET `money` = (`money`-" . $podzemdata[$podzemroom]['passprice'] . ") WHERE `id` = '$user[id]' LIMIT 1"); mysql_query("INSERT INTO `delo` (`id`, `author`, `pers`, `text`, `type`, `date`) VALUES ('', '0', '{$_SESSION['uid']}', '\"" . $user['login'] . "\" пожертвовал на благоустройство пещеры \"" . $podzemdata[$podzemroom]['passprice'] . "\" кр. ($user[money]/$user[ekr]). ', 7, '" . time() . "')"); $wait_sec = 0; } else { echo "У вас недостаточно денег"; } } } if ($wait_sec > $new_t) { echo " Вы можете посетить " . $podzemdata[$podzemroom]['name1'] . " через " . secs2hrs($left_time) . "
"; if ($podzemdata[$podzemroom]['passprice']) { echo "Пожертвовав " . $podzemdata[$podzemroom]['passprice'] . " кр. на благоустройство " . $podzemdata[$podzemroom]['name2'] . ", это можно сделать прямо сейчас. Пожертвовать."; } } else { mysql_query("DELETE FROM `visit_podzem` WHERE `login` = '" . $user['login'] . "' AND `room` = '$podzemroom' LIMIT 1"); echo ""; exit(); } } else { $login = $user['login']; $ya = mysql_query("SELECT `login` FROM `vxodd` WHERE `login` = '$login' LIMIT 1"); $wawe = "0"; if ($daw = mysql_fetch_array($ya)) { $wawe = "1"; } $naw = mysql_query("SELECT `login` FROM `vxod` WHERE `login` = '$login' LIMIT 1"); $nawe = "0"; if ($ser = mysql_fetch_array($naw)) { $nawe = "1"; } $rt = mysql_query("SELECT `id`, `level` FROM `users` WHERE `login` = '$login' LIMIT 1"); $est = mysql_fetch_array($rt); $user_id = $est['id']; $user_lvl = $est['level']; if ($wawe == 0) { echo "
Группа
Комментарий
Пароль
"; } else { echo "
Группа "; if ($nawe == 1) { echo "  "; } echo "
"; } if ($_GET['warning'] == 1) { echo " Вы покинули группу"; } if ($_GET['warning'] == 2) { echo " Увы! Не угадали пароль!"; } if ($_GET['warning'] == 3) { echo " Вы подали заявку, сначала отзовите её!"; } if ($_GET['warning'] == 4) { echo " Вы уже в группе!"; } if ($_GET['warning'] == 5) { echo " Группа уже собрана!"; } if ($_GET['warning'] == 6) { echo " Максимальная плата для вашего уровня: "; if ($user['level'] < 5) { echo "1500 кр"; } elseif ($user['level'] < 7) { echo "3500 кр"; } else { echo "6500 кр"; } echo "!"; } if ($_GET['warning'] == 7) { echo " Недостаточно денег для оплаты."; } if ($_GET['warning'] == 8) { echo " Со склонностью хаос оплата походов запрещена."; } echo ""; $i = 0; function isonlinelogin($l) { $i = mysql_fetch_assoc(mysql_query("SELECT DISTINCT(`users`.`id`) FROM `online` LEFT JOIN `users` ON (`users`.`id` = `online`.`id`) WHERE `date` >= " . (time() - 60) . " AND `users`.`login` = '$l'")); return $i; } $Q = mysql_query("SELECT * FROM `vxod` WHERE `room` = '$user->room'"); while ($DATA = mysql_fetch_array($Q)) { $cr = $DATA['glav_id']; $z_login[$i] = $DATA['login']; $date[$i] = $DATA['date']; $comment[$i] = $DATA['comment']; $password[$i] = $DATA['pass']; $mine_z[$i] = 0; $Q2 = mysql_query("SELECT `glav_id` FROM `vxodd` WHERE `glav_id` = '$cr'"); $t1_all[$i] = 0; while ($DATAS = mysql_fetch_array($Q2)) { $t1_all[$i]++; } $creator[$i] = $DATA['glav_id']; $i++; } for ($n = 0; $n < $i; $n++) { echo ""; } ?>
$date[$n] "; $QUER = mysql_query("SELECT `login`, `lvl`, `fee` FROM `vxodd` WHERE `glav_id` = '$creator[$n]' ORDER BY `id` ASC"); while ($DATAS = mysql_fetch_array($QUER)) { if ($user['id'] == 10022) { $ol = isonlinelogin($DATAS['login']); if (!$ol) { mysql_query("DELETE FROM `vxod` WHERE `login` = '$DATAS[login]'"); mysql_query("DELETE FROM `vxodd` WHERE `glav_id` = '" . mysql_fetch_assoc(mysql_query("SELECT `id` FROM `users` WHERE `login` = '$DATAS[login]'")) . "'"); mysql_query("DELETE FROM `vxodd` WHERE `login` = '$DATAS[login]'"); } } $p1 = $DATAS['login']; $p_login = $DATAS['login']; $p_lvl = $DATAS['lvl']; if ($p1 != '') { $p1 = "$p1 [$p_lvl] "; if ($t1_all[$n] == 1) { echo "$p1"; } else { echo "$p1,"; } } } if (!empty($comment[$n])) { echo "| $comment[$n] "; } if ($wawe == 0) { if (!empty($password[$n])) { echo " "; } echo ""; } echo "
location.href='?warning=4'"; exit(); } $time = date("H:i"); $SQL2 = mysql_query("INSERT INTO `vxod` (`date`, `login`, `glav_id`, `comment`, `pass`, `room`) VALUES('$time', '$login', '$user_id', '" . mysql_real_escape_string($_GET['cmt']) . "', '" . mysql_real_escape_string($_GET['pass']) . "', '$user->room')"); $SQL2 = mysql_query("INSERT INTO `vxodd` (`login`, `glav_id`, `lvl`) VALUES('$login', '$user_id', '$user_lvl')"); if ($SQL2) { echo ""; exit(); } else { echo "Ошибка!!! Сообщите администратору!"; } } //////////////Удаление заявки////////////////////// if ($_GET['del']) { $e = mysql_query("DELETE FROM `vxod` WHERE `login` = '$login'"); $es = mysql_query("DELETE FROM `vxodd` WHERE `glav_id` = '$user_id'"); $ed = mysql_query("DELETE FROM `vxodd` WHERE `login` = '$login'"); if ($e) { echo ""; exit(); } else { echo "Ошибка!!! Сообщите администратору!"; } } if ($_GET['add']) { $der = mysql_query("SELECT `glav_id`, `id` FROM `vxodd` WHERE `login` = '" . $user['login'] . "' LIMIT 1"); if ($deras = mysql_fetch_array($der)) { echo ""; exit(); } $den = mysql_query("SELECT `id` FROM `vxodd` WHERE `glav_id` = '" . $_GET['naw_id'] . "'"); if (mysql_num_rows($den) >= (in_array($user->room + 1, Config::$caverooms) ? 5 : 4)) { echo ""; exit(); } if ($_GET['naw_id']) { $fee = (int)$_GET['fee']; if ($fee < 0) { $fee = 0; } $badfee = 0; if ($fee > 1500 && $user['level'] < 5) { $badfee = 1; } elseif ($fee > 3500 && $user['level'] < 7) { $badfee = 1; } elseif ($fee > 6500) { $badfee = 1; } elseif ($fee > $user['money']) { $badfee = 2; } if ($user['align'] == 4 && $fee > 0) { $badfee = 3; } $p = mysql_fetch_assoc(mysql_query("SELECT `pass` FROM `vxod` WHERE `glav_id` = '$_GET[naw_id]' LIMIT 1")); if ($badfee) { echo ""; exit(); } elseif ($p['pass'] == $_GET['pass']) { $rt = mysql_query("SELECT `level` FROM `users` WHERE `login` = '$login' LIMIT 1"); $est = mysql_fetch_array($rt); $s = mysql_query("INSERT INTO `vxodd` (`login`, `glav_id`, `lvl`, `fee`) VALUES('$login', '" . $_GET['naw_id'] . "', '" . $est['level'] . "', '$fee')"); if ($s) { echo ""; exit(); } else { echo "Ошибка!!! Сообщите администратору!"; } } else { echo ""; exit(); } } else { echo ""; exit(); } } if ($_GET['start']){ if (in_array($user->room + 1, Config::$caverooms)) { $nc = 1; $locs = []; } $zax = mysql_query("SELECT `login`, `fee` FROM `vxodd` WHERE `glav_id` = '" . $user['id'] . "'"); $level = 0; while ($nana = mysql_fetch_array($zax)) { $n_login = $nana['login']; $rty = mysql_query("SELECT `id`, `level`, `login`, `shadow`, `money`, `hp` FROM `users` WHERE `login` = '$n_login' LIMIT 1"); $esth = mysql_fetch_array($rty); if ($esth['hp'] <= 0) { $esth['hp'] = 1; mysql_query('UPDATE `users` SET `hp` = "' . $esth['hp'] . '" WHERE `id` = "' . $esth['id'] . '" LIMIT 1'); } if ($nana['fee']) { if ($nana['fee'] > $esth['money']) { continue; } mysql_query("UPDATE `users` SET `money` = (`money+$nana[fee]) WHERE `id` = '$user[id]' LIMIT 1"); mysql_query("update `users` SET `money` = (`money-$nana[fee]) WHERE `id` = '$esth[id]' LIMIT 1"); $user['money'] += $nana['fee']; $esth['money'] -= $nana['fee']; adddelo($user['id'], "Персонаж $user[login] получил $nana[fee] кр. за поход по локации \"" . $rooms[$user->room + 1] . "\" от персонажа $esth[login] ($user[money]).", 1); adddelo($esth['id'], "Персонаж $esth[login] заплатил $nana[fee] кр. за поход по локации \"" . $rooms[$user->room + 1] . "\" персонажу $user[login] ($esth[money]).", 1); } if ($esth['level'] > $level) { $level = $esth['level']; } $est_id = $esth['id']; $est_login = $esth['login']; $vremya = 60 * 60 * 6 + time(); mysql_query('INSERT INTO `visit_podzem` (`login`, `time`, `room`) VALUES ("' . $n_login . '", "' . $vremya . '", \'' . $podzemroom . '\')'); $vrem = 30 * 60 + time(); $cavedata = Config::$cavedata ?? []; mysql_query("INSERT INTO `caveparties` SET `user` = '$esth[id]', `leader` = '$user[id]', `login` = '$esth[login]', `shadow` = '0.png', `x` = '" . $cavedata[$user->room + 1]['x1'] . "', `y` = '" . $cavedata[$user->room + 1]['y1'] . "', `dir` = '" . $cavedata[$user->room + 1]['dir1'] . "', `floor` = 1"); mysql_query("UPDATE `users`, `online` SET " . ($nc ? "`users`.`caveleader` = '$user[id]', " : "") . " `users`.`room` = '" . ($user->room + 1) . "', `online`.`room` = '" . ($user->room + 1) . "' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $esth['id'] . "'"); } if ($nc) { $r = mysql_query("SELECT * FROM `cavemaps` WHERE `room` = '$user->room'"); while ($rec = mysql_fetch_assoc($r)) { $map = unserialize($rec['map']); foreach ($map as $k => $v) { foreach ($v as $k2 => $v2) { $obj = substr($v2, 0, 1); if ($obj == "b" || $obj == "a" || $obj == "w") { $tmp = explode("/", $v2); $i = 1; if ($obj == "b") { $t = 0; } elseif ($obj == "w") { $t = 1; } else { $t = 2; } while ($tmp[$i]) { mysql_query("INSERT INTO `cavebots` SET `leader` = '$user[id]', `x` = '$k2', `y` = '$k', `startx` = '$k2', `starty` = '$k', `bot` = '$tmp[$i]', `cnt` = '" . ($tmp[$i + 1]) . "', `floor` = '$rec[floor]', `type` = '$t'"); $i += 2; } $map[$k][$k2] = 2; } } } include('cave_add_objects.php'); mysql_query("INSERT INTO `caves` SET `leader` = '$user[id]', `map` = '" . serialize($map) . "', `level` = '$level', `floor` = '$rec[floor]'"); savecavedata([], $user['id'], $rec['floor']); } } ?> location.href='cave.php'"; exit(); } } ?>