Прикручиваем шаблон. Хороним идиотские ошибки.
This commit is contained in:
parent
bc0992f281
commit
354499f885
195
enter_cave.php
195
enter_cave.php
@ -74,35 +74,19 @@ if (in_array($user->room, Config::$canalenters)) {
|
|||||||
$podzemroom = $user->room + 1;
|
$podzemroom = $user->room + 1;
|
||||||
$cavedata = [620 => ['x1' => 3, 'y1' => 2, 'dir1' => 2]];
|
$cavedata = [620 => ['x1' => 3, 'y1' => 2, 'dir1' => 2]];
|
||||||
$podzemdata = [621 => ['name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']];
|
$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>
|
<div id=hint4 class=ahint></div>
|
||||||
|
|
||||||
<TABLE width=100%>
|
<TABLE width=100%>
|
||||||
<TR>
|
<TR>
|
||||||
<TD valign=top width=100%>
|
<TD valign=top width=100%>
|
||||||
<center><h3><?= $rooms[$user["room"]] ?></h3></center>
|
<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");
|
$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)) {
|
if ($el = mysql_fetch_array($select)) {
|
||||||
$wait_sec = $el['time'];
|
$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");
|
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 ($wait_sec > $new_t && $_GET['donate']) {
|
||||||
if ($_GET['donate']) {
|
if ($user['money'] >= $podzemdata[$podzemroom]['passprice']) {
|
||||||
if ($user['money'] >= $podzemdata[$podzemroom]['passprice']) {
|
mysql_query("UPDATE `users` SET `money` = (`money`-" . $podzemdata[$podzemroom]['passprice'] . ") WHERE `id` = '$user[id]' LIMIT 1");
|
||||||
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() . "')");
|
||||||
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;
|
||||||
$wait_sec = 0;
|
} else {
|
||||||
} else {
|
echo "<b><font color=red>У вас недостаточно денег</font></b>";
|
||||||
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>
|
<TD height=1 colspan=2><SPAN></SPAN></TD>
|
||||||
</TR>
|
</TR>
|
||||||
</TABLE>
|
</TABLE>
|
||||||
<?
|
<?php
|
||||||
|
|
||||||
///////////////Подача заявки////////////////////
|
///////////////Подача заявки////////////////////
|
||||||
if ($_GET['open']) {
|
if ($_GET['open']) {
|
||||||
@ -379,94 +361,94 @@ if (in_array($user->room, Config::$canalenters)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET['start']){
|
if ($_GET['start']) {
|
||||||
if (in_array($user->room + 1, Config::$caverooms)) {
|
if (in_array($user->room + 1, Config::$caverooms)) {
|
||||||
$nc = 1;
|
$nc = 1;
|
||||||
$locs = [];
|
$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']) {
|
$zax = mysql_query("SELECT `login`, `fee` FROM `vxodd` WHERE `glav_id` = '" . $user['id'] . "'");
|
||||||
if ($nana['fee'] > $esth['money']) {
|
$level = 0;
|
||||||
continue;
|
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");
|
if ($nana['fee']) {
|
||||||
mysql_query("update `users` SET `money` = (`money-$nana[fee]) WHERE `id` = '$esth[id]' LIMIT 1");
|
if ($nana['fee'] > $esth['money']) {
|
||||||
$user['money'] += $nana['fee'];
|
continue;
|
||||||
$esth['money'] -= $nana['fee'];
|
}
|
||||||
adddelo($user['id'], "Персонаж $user[login] получил $nana[fee] кр. за поход по локации \"" . $rooms[$user->room + 1] . "\" от персонажа $esth[login] ($user[money]).", 1);
|
mysql_query("UPDATE `users` SET `money` = (`money+$nana[fee]) WHERE `id` = '$user[id]' LIMIT 1");
|
||||||
adddelo($esth['id'], "Персонаж $esth[login] заплатил $nana[fee] кр. за поход по локации \"" . $rooms[$user->room + 1] . "\" персонажу $user[login] ($esth[money]).", 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 . '\')');
|
if ($nc) {
|
||||||
$vrem = 30 * 60 + time();
|
$r = mysql_query("SELECT * FROM `cavemaps` WHERE `room` = '$user->room'");
|
||||||
|
while ($rec = mysql_fetch_assoc($r)) {
|
||||||
$cavedata = Config::$cavedata ?? [];
|
$map = unserialize($rec['map']);
|
||||||
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");
|
foreach ($map as $k => $v) {
|
||||||
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'] . "'");
|
foreach ($v as $k2 => $v2) {
|
||||||
}
|
$obj = substr($v2, 0, 1);
|
||||||
|
if ($obj == "b" || $obj == "a" || $obj == "w") {
|
||||||
if ($nc) {
|
$tmp = explode("/", $v2);
|
||||||
$r = mysql_query("SELECT * FROM `cavemaps` WHERE `room` = '$user->room'");
|
$i = 1;
|
||||||
while ($rec = mysql_fetch_assoc($r)) {
|
if ($obj == "b") {
|
||||||
$map = unserialize($rec['map']);
|
$t = 0;
|
||||||
foreach ($map as $k => $v) {
|
} elseif ($obj == "w") {
|
||||||
foreach ($v as $k2 => $v2) {
|
$t = 1;
|
||||||
$obj = substr($v2, 0, 1);
|
} else {
|
||||||
if ($obj == "b" || $obj == "a" || $obj == "w") {
|
$t = 2;
|
||||||
$tmp = explode("/", $v2);
|
}
|
||||||
$i = 1;
|
while ($tmp[$i]) {
|
||||||
if ($obj == "b") {
|
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'");
|
||||||
$t = 0;
|
$i += 2;
|
||||||
} elseif ($obj == "w") {
|
}
|
||||||
$t = 1;
|
$map[$k][$k2] = 2;
|
||||||
} 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']);
|
||||||
}
|
}
|
||||||
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>
|
<script>top.frames['online'].location = 'ch.php?online=' + Math.round(Math.random() * 100000);</script>
|
||||||
<?
|
<?php
|
||||||
mysql_query("DELETE FROM `vxod` WHERE `login` = '$login'");
|
mysql_query("DELETE FROM `vxod` WHERE `login` = '$login'");
|
||||||
mysql_query("DELETE FROM `vxodd` WHERE `glav_id` = " . $user['id'] . "");
|
mysql_query("DELETE FROM `vxodd` WHERE `glav_id` = " . $user['id'] . "");
|
||||||
mysql_query("DELETE FROM `vxodd` WHERE `login` = '$login'");
|
mysql_query("DELETE FROM `vxodd` WHERE `login` = '$login'");
|
||||||
print "<script>location.href='cave.php'</script>";
|
print "<script>location.href='cave.php'</script>";
|
||||||
exit();
|
exit();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<TD nowrap valign=top>
|
<TD nowrap valign=top>
|
||||||
|
|
||||||
<BR>
|
<BR>
|
||||||
<DIV align=right>
|
<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>
|
value=Обновить type=button>
|
||||||
<input style="font-size: 12px;" type="button" value="Вернуться"
|
<input style="font-size: 12px;" type="button" value="Вернуться"
|
||||||
onclick="document.location.href='enter_cave.php?ext=1';"/>
|
onclick="document.location.href='enter_cave.php?ext=1';"/>
|
||||||
@ -478,10 +460,7 @@ if (in_array($user->room, Config::$canalenters)) {
|
|||||||
</TABLE>
|
</TABLE>
|
||||||
<div id="goto" style="text-align:right;white-space:nowrap"> </div>
|
<div id="goto" style="text-align:right;white-space:nowrap"> </div>
|
||||||
<br><br>
|
<br><br>
|
||||||
</BODY>
|
<?php
|
||||||
</HTML>
|
|
||||||
<?
|
|
||||||
} else {
|
} else {
|
||||||
header("location: main.php");
|
header("location: main.php");
|
||||||
}
|
}
|
||||||
?>
|
|
Loading…
Reference in New Issue
Block a user