Прикручиваем шаблон. Хороним идиотские ошибки.
This commit is contained in:
parent
bc0992f281
commit
354499f885
193
enter_cave.php
193
enter_cave.php
@ -74,35 +74,19 @@ if (in_array($user->room, Config::$canalenters)) {
|
||||
$podzemroom = $user->room + 1;
|
||||
$cavedata = [620 => ['x1' => 3, 'y1' => 2, 'dir1' => 2]];
|
||||
$podzemdata = [621 => ['name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']];
|
||||
$warning = $_GET["warning"] ?? '';
|
||||
Template::header('enter_cave');
|
||||
if ($warning) {
|
||||
echo sprintf('<b style="color: #f80000">%s</b>', $warning);
|
||||
}
|
||||
?>
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<script LANGUAGE='JavaScript'>
|
||||
document.ondragstart = test;
|
||||
//запрет на перетаскивание
|
||||
document.onselectstart = test;
|
||||
//запрет на выделение элементов страницы
|
||||
document.oncontextmenu = test;
|
||||
|
||||
//запрет на выведение контекстного меню
|
||||
function test() {
|
||||
return false
|
||||
}
|
||||
</SCRIPT>
|
||||
<link rel=stylesheet href="css/main.css">
|
||||
<meta charset="UTF-8">
|
||||
</HEAD>
|
||||
<BODY style="background-color: #dedede;">
|
||||
<? if ($_GET["warning"] && strlen($_GET["warning"]) > 1) {
|
||||
echo "<b><font color=red>$_GET[warning]</font></b>";
|
||||
} ?>
|
||||
<div id=hint4 class=ahint></div>
|
||||
|
||||
<TABLE width=100%>
|
||||
<TR>
|
||||
<TD valign=top width=100%>
|
||||
<center><h3><?= $rooms[$user["room"]] ?></h3></center>
|
||||
<?
|
||||
<?php
|
||||
$select = mysql_query("SELECT `time` FROM `visit_podzem` WHERE `room` = '$podzemroom' AND `login` = '" . $user['login'] . "' AND `time` > 0 LIMIT 1");
|
||||
if ($el = mysql_fetch_array($select)) {
|
||||
$wait_sec = $el['time'];
|
||||
@ -116,15 +100,13 @@ if (in_array($user->room, Config::$canalenters)) {
|
||||
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 "<b><font color=red>У вас недостаточно денег</font></b>";
|
||||
}
|
||||
if ($wait_sec > $new_t && $_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 "<b><font color=red>У вас недостаточно денег</font></b>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,7 +274,7 @@ if (in_array($user->room, Config::$canalenters)) {
|
||||
<TD height=1 colspan=2><SPAN></SPAN></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<?
|
||||
<?php
|
||||
|
||||
///////////////Подача заявки////////////////////
|
||||
if ($_GET['open']) {
|
||||
@ -379,94 +361,94 @@ if (in_array($user->room, Config::$canalenters)) {
|
||||
}
|
||||
}
|
||||
|
||||
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 ($_GET['start']) {
|
||||
if (in_array($user->room + 1, Config::$caverooms)) {
|
||||
$nc = 1;
|
||||
$locs = [];
|
||||
}
|
||||
if ($nana['fee']) {
|
||||
if ($nana['fee'] > $esth['money']) {
|
||||
continue;
|
||||
$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');
|
||||
}
|
||||
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 ($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 ($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;
|
||||
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;
|
||||
}
|
||||
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']);
|
||||
}
|
||||
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']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
<script>top.frames['online'].location = 'ch.php?online=' + Math.round(Math.random() * 100000);</script>
|
||||
<?
|
||||
mysql_query("DELETE FROM `vxod` WHERE `login` = '$login'");
|
||||
mysql_query("DELETE FROM `vxodd` WHERE `glav_id` = " . $user['id'] . "");
|
||||
mysql_query("DELETE FROM `vxodd` WHERE `login` = '$login'");
|
||||
print "<script>location.href='cave.php'</script>";
|
||||
exit();
|
||||
}
|
||||
<?php
|
||||
mysql_query("DELETE FROM `vxod` WHERE `login` = '$login'");
|
||||
mysql_query("DELETE FROM `vxodd` WHERE `glav_id` = " . $user['id'] . "");
|
||||
mysql_query("DELETE FROM `vxodd` WHERE `login` = '$login'");
|
||||
print "<script>location.href='cave.php'</script>";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<TD nowrap valign=top>
|
||||
|
||||
<BR>
|
||||
<DIV align=right>
|
||||
<INPUT style="font-size:12px;" onClick="document.location.href='enter_cave.php?<? echo time(); ?>'"
|
||||
<INPUT style="font-size:12px;" onClick="document.location.href='enter_cave.php?<?= time(); ?>'"
|
||||
value=Обновить type=button>
|
||||
<input style="font-size: 12px;" type="button" value="Вернуться"
|
||||
onclick="document.location.href='enter_cave.php?ext=1';"/>
|
||||
@ -478,10 +460,7 @@ if (in_array($user->room, Config::$canalenters)) {
|
||||
</TABLE>
|
||||
<div id="goto" style="text-align:right;white-space:nowrap"> </div>
|
||||
<br><br>
|
||||
</BODY>
|
||||
</HTML>
|
||||
<?
|
||||
<?php
|
||||
} else {
|
||||
header("location: main.php");
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user