optimal parameter fix
This commit is contained in:
parent
e4fc8ffe40
commit
0eb5cbef31
116
zayavka.php
116
zayavka.php
@ -30,7 +30,7 @@ if (!empty($_GET['del']) && $user['admin'] == 1) { //удаление заявк
|
||||
echo 'Заявка не найдена ...';
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['view'] = false;
|
||||
if (isset($_REQUEST['view'])) $_SESSION['view'] = $_REQUEST['view'];
|
||||
|
||||
class zayavka
|
||||
@ -106,62 +106,28 @@ class zayavka
|
||||
}
|
||||
}
|
||||
|
||||
if ($user['zayavka'] != 0) {
|
||||
return "Вы находитесь в заявке";
|
||||
}
|
||||
if (!empty($user['zayavka'])) return "Вы находитесь в заявке";
|
||||
|
||||
if ($user['hp'] < $user['maxhp'] * 0.33) {
|
||||
return "Вы слишком ослаблены для боя, восстановитесь.";
|
||||
}
|
||||
if ($user['hp'] < $user['maxhp'] * 0.33) return "Вы слишком ослаблены для боя, восстановитесь.";
|
||||
|
||||
if (!$z) {
|
||||
return "Эта заявка не может быть принята Вами.";
|
||||
}
|
||||
if (!$z) return "Эта заявка не может быть принята Вами.";
|
||||
|
||||
if ($this->user_status($id) != 0) {
|
||||
return "Эта заявка не может быть принята Вами.";
|
||||
}
|
||||
if ($this->user_status($id) != 0) return "Эта заявка не может быть принята Вами.";
|
||||
|
||||
if ($z[$zay]['type'] == 3 || $z[$zay]['type'] == 5) {
|
||||
if ($z[$zay]['type'] != 3 OR $z[$zay]['type'] != 5) {
|
||||
if ($team == 1) $teamz = 2;
|
||||
else $teamz = 1;
|
||||
|
||||
} else {
|
||||
if ($team == 1) {
|
||||
$teamz = 2;
|
||||
} else {
|
||||
$teamz = 1;
|
||||
}
|
||||
foreach ($z[$zay]['team' . $teamz] as $v) {
|
||||
$toper = mysql_fetch_array(mysql_query("SELECT `klan`, `align` FROM `users` WHERE `id` = '{$v}' LIMIT 1"));
|
||||
if ($toper['klan'] > 0) {
|
||||
if ((int)$user['klan'] == (int)$toper['klan']) {
|
||||
return "Чтите честь Ваших сокланов.";
|
||||
}
|
||||
}
|
||||
|
||||
if ((int)$user['align'] == 1) {
|
||||
if ((int)$toper['align'] == 1) {
|
||||
return "Чтите честь Паладинов.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($user['align'] == 6) {
|
||||
if ($toper['align'] == 6) {
|
||||
return "Не предавайте свет.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($user['align'] == 3) {
|
||||
if ($toper['align'] == 3) {
|
||||
return "Не предавайте тьму.";
|
||||
}
|
||||
}
|
||||
$enemy = db::c()->query('SELECT `klan` FROM `users` WHERE `id` = ?i', $v)->fetch_assoc();
|
||||
if ($user['klan'] == $enemy['klan']) return "Нельзя драться против сокланов!";
|
||||
}
|
||||
}
|
||||
|
||||
if ($z[$zay]['t' . $team . 'min'] == 99) {
|
||||
$toper = $z[$zay]['team' . $team][0];
|
||||
$toper = mysql_fetch_array(mysql_query("SELECT `id`, `login`, `align`, `klan`, `level` FROM `users` WHERE `id` = '{$toper}' LIMIT 1"));
|
||||
if ($toper['klan'] != '') {
|
||||
if (!empty($toper['klan'])) {
|
||||
if ($user['klan'] != $toper['klan']) {
|
||||
return "Эта заявка не может быть принята Вами.";
|
||||
}
|
||||
@ -181,14 +147,14 @@ class zayavka
|
||||
} else return 'addteam(): database error!';
|
||||
}
|
||||
|
||||
function delteam($team = 2, $id, $zay, $r)
|
||||
function delteam($id, $zay, $r)
|
||||
{
|
||||
$z = $this->getlist($r, null, $zay);
|
||||
if ($z[$zay]['level'] > 3 || $z[$zay]['level'] == null) {
|
||||
return "Ай-ай-ай!";
|
||||
}
|
||||
|
||||
foreach ($z[$zay]['team' . $team] as $v) {
|
||||
foreach ($z[$zay]['team2'] as $v) {
|
||||
if ($v != $id) {
|
||||
$teams[] = $v;
|
||||
}
|
||||
@ -615,21 +581,21 @@ VALUES ("?s","?s",?i,?i,?i,"?s","?s",?i,?i,?i,?i)',
|
||||
|
||||
foreach ($z['team1'] as $k => $v) {
|
||||
if ($v < _BOTSEPARATOR_) {
|
||||
db::c()->query('UPDATE `users` SET `battle` = ?i, `zayavka` = 0 WHERE `id` = ?i',$id, $v);
|
||||
db::c()->query('UPDATE `users` SET `battle` = ?i, `zayavka` = 0 WHERE `id` = ?i', $id, $v);
|
||||
} else {
|
||||
db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i',$id, $v);
|
||||
db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i', $id, $v);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($z['team2'] as $k => $v) {
|
||||
if ($v < _BOTSEPARATOR_) {
|
||||
db::c()->query('UPDATE `users` SET `battle` = ?i, `zayavka` = 0 WHERE `id` = ?i',$id, $v);
|
||||
db::c()->query('UPDATE `users` SET `battle` = ?i, `zayavka` = 0 WHERE `id` = ?i', $id, $v);
|
||||
} else {
|
||||
db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i',$id, $v);
|
||||
db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i', $id, $v);
|
||||
}
|
||||
}
|
||||
if ($bot) {
|
||||
db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i',$id, $bot['id']);
|
||||
db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i', $id, $bot['id']);
|
||||
}
|
||||
}
|
||||
if ($user['zayavka'] == $zay) {
|
||||
@ -672,10 +638,10 @@ if (!empty($_POST['open'])) {
|
||||
</script>
|
||||
</HEAD>
|
||||
<body onload="top.setHP(<?= $user['hp'] ?>,<?= $user['maxhp'] ?>,<?php if (!$user['battle']) {
|
||||
echo "100";
|
||||
} else {
|
||||
echo "0";
|
||||
} ?>);">
|
||||
echo "100";
|
||||
} else {
|
||||
echo "0";
|
||||
} ?>);">
|
||||
<TABLE width=100% cellspacing=1 cellpadding=1>
|
||||
<FORM METHOD=POST name=F1>
|
||||
<TR>
|
||||
@ -689,9 +655,9 @@ if (!empty($_POST['open'])) {
|
||||
<TR>
|
||||
<TD class=m width=40> <B><?php if ($user['room'] != 101) echo 'Бои:'; else echo 'Разделы:'; ?></B></TD>
|
||||
<?php //FIXME Убрать этот адов пиздец, когда одни и те же ссылки ведут в разные места и называются по разному. Или нормально понять зачем это. ?>
|
||||
<TD class=<?= ($level == 'begin') ? "s" : "m" ?>><?php if ($user['room'] != 101) echo("<A HREF=\"zayavka.php?level=begin&".mt_rand()."\">Новичков</A></TD>"); else echo 'Зал Славы Тьмы</TD>' ?>
|
||||
<TD class=<?= ($level == 'fiz') ? "s" : "m" ?>><?php if ($user['room'] != 101) echo("<A HREF=\"zayavka.php?level=fiz&".mt_rand()."\">Физические</A></TD>"); else echo 'Зал Славы Света</TD>' ?>
|
||||
<TD class=<?= ($level == 'dgv') ? "s" : "m" ?>><?php if ($user['room'] != 101) echo("<A HREF=\"zayavka.php?level=dgv&".mt_rand()."\">Договорные</A></TD>"); else echo 'Квесты</TD>' ?>
|
||||
<TD class=<?= ($level == 'begin') ? "s" : "m" ?>><?php if ($user['room'] != 101) echo("<A HREF=\"zayavka.php?level=begin&" . mt_rand() . "\">Новичков</A></TD>"); else echo 'Зал Славы Тьмы</TD>' ?>
|
||||
<TD class=<?= ($level == 'fiz') ? "s" : "m" ?>><?php if ($user['room'] != 101) echo("<A HREF=\"zayavka.php?level=fiz&" . mt_rand() . "\">Физические</A></TD>"); else echo 'Зал Славы Света</TD>' ?>
|
||||
<TD class=<?= ($level == 'dgv') ? "s" : "m" ?>><?php if ($user['room'] != 101) echo("<A HREF=\"zayavka.php?level=dgv&" . mt_rand() . "\">Договорные</A></TD>"); else echo 'Квесты</TD>' ?>
|
||||
<TD class=<?= ($level == 'group') ? "s" : "m" ?>><A HREF="zayavka.php?level=group&<?= mt_rand() ?>">
|
||||
<?php if ($user['room'] != 101) {
|
||||
echo 'Групповые';
|
||||
@ -699,24 +665,26 @@ if (!empty($_POST['open'])) {
|
||||
echo '<span style="color:red; font-weight: bold;">Тьма vs Свет</span>';
|
||||
}; ?>
|
||||
</A></TD>
|
||||
<TD class=<?= ($level == 'haos') ? "s" : "m" ?>><?php if ($user['room'] != 101) echo("<A HREF=\"zayavka.php?level=haos&".mt_rand()."\">Хаотичные</A></TD>"); else echo 'В разработке</TD>' ?>
|
||||
<TD class=<?= (input::check('tklogs') == '1') ? "s" : "m" ?>><A HREF="zayavka.php?tklogs=1&<?= mt_rand() ?>">Текущие</A>
|
||||
<TD class=<?= ($level == 'haos') ? "s" : "m" ?>><?php if ($user['room'] != 101) echo("<A HREF=\"zayavka.php?level=haos&" . mt_rand() . "\">Хаотичные</A></TD>"); else echo 'В разработке</TD>' ?>
|
||||
<TD class=<?= (input::check('tklogs') == '1') ? "s" : "m" ?>><A
|
||||
HREF="zayavka.php?tklogs=1&<?= mt_rand() ?>">Текущие</A>
|
||||
</TD>
|
||||
<TD class=<?= (!is_null($logs)) ? "s" : "m" ?>><A HREF="zayavka.php?logs=<?= date("d.m.y") ?>&<?= mt_rand() ?>">Завершенные</A></TD>
|
||||
<TD class=<?= (!is_null($logs)) ? "s" : "m" ?>><A
|
||||
HREF="zayavka.php?logs=<?= date("d.m.y") ?>&<?= mt_rand() ?>">Завершенные</A></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<TABLE width=100% cellspacing=0 cellpadding=0>
|
||||
<TR>
|
||||
<TD valign=top>
|
||||
<?php
|
||||
if (!in_array($user['room'], [1,2,3,4,5,6,7,8,9,10,15,16,19,101]) AND empty($logs) AND empty($tklogs)) die(err('В этой комнате невозможно подавать заявки!'));
|
||||
// if ($user['room'] != 1 && $user['room'] != 2 && $user['room'] != 3 && $user['room'] != 4 &&
|
||||
// $user['room'] != 5 && $user['room'] != 6 && $user['room'] != 7 && $user['room'] != 9 &&
|
||||
// $user['room'] != 10 && $user['room'] != 15 && $user['room'] != 16 && $user['room'] != 19 &&
|
||||
// $user['room'] != 8 && $user['room'] != 101 && !$tklogs && !$logs) {
|
||||
// echo "<BR><BR><BR><CENTER><B>В этой комнате невозможно подавать заявки</b></CENTER>";
|
||||
// die();
|
||||
// }
|
||||
if (!in_array($user['room'], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 19, 101]) AND empty($logs) AND empty($tklogs)) die(err('В этой комнате невозможно подавать заявки!'));
|
||||
// if ($user['room'] != 1 && $user['room'] != 2 && $user['room'] != 3 && $user['room'] != 4 &&
|
||||
// $user['room'] != 5 && $user['room'] != 6 && $user['room'] != 7 && $user['room'] != 9 &&
|
||||
// $user['room'] != 10 && $user['room'] != 15 && $user['room'] != 16 && $user['room'] != 19 &&
|
||||
// $user['room'] != 8 && $user['room'] != 101 && !$tklogs && !$logs) {
|
||||
// echo "<BR><BR><BR><CENTER><B>В этой комнате невозможно подавать заявки</b></CENTER>";
|
||||
// die();
|
||||
// }
|
||||
|
||||
if (!$level && !$tklogs && !$logs) {
|
||||
echo "<BR><BR><BR><CENTER><B>Выберите раздел</b></CENTER>";
|
||||
@ -740,11 +708,11 @@ if (!empty($_POST['open'])) {
|
||||
if ($_POST['back2']) {
|
||||
$z = $zay->getlist(1, null, $user['zayavka']);
|
||||
AddChatSystem('Внимание!' . nick::id($user['id'])->short() . ' отозвал заявку.');
|
||||
echo $zay->delteam(2, $user['id'], $user['zayavka'], 1);
|
||||
echo $zay->delteam($user['id'], $user['zayavka'], 1);
|
||||
}
|
||||
if ($_POST['cansel']) {
|
||||
$z = $zay->getlist(1, null, $user['zayavka']);
|
||||
echo $zay->delteam(2, $z[$user['zayavka']]['team2'][0], $user['zayavka'], 1);
|
||||
echo $zay->delteam($z[$user['zayavka']]['team2'][0], $user['zayavka'], 1);
|
||||
AddChatSystem('Внимание!' . nick::id($user['id'])->short() . ' отказался от поединка.');
|
||||
}
|
||||
if ($_POST['confirm2']) {
|
||||
@ -852,11 +820,11 @@ if (!empty($_POST['open'])) {
|
||||
if (!empty($_POST['back2'])) {
|
||||
$z = $zay->getlist(2, null, $user['zayavka']);
|
||||
AddChatSystem('Внимание!' . nick::id($user['id'])->short() . ' отозвал заявку.');
|
||||
echo $zay->delteam(2, $user['id'], $user['zayavka'], 2);
|
||||
echo $zay->delteam($user['id'], $user['zayavka'], 2);
|
||||
}
|
||||
if (!empty($_POST['cansel'])) {
|
||||
$z = $zay->getlist(2, null, $user['zayavka']);
|
||||
echo $zay->delteam(2, $z[$user['zayavka']]['team2'][0], $user['zayavka'], 2);
|
||||
echo $zay->delteam($z[$user['zayavka']]['team2'][0], $user['zayavka'], 2);
|
||||
AddChatSystem('Внимание!' . nick::id($user['id'])->short() . ' отказался от поединка.');
|
||||
}
|
||||
if (!empty($_POST['confirm2']) AND empty($user['zayavka'])) {
|
||||
|
Loading…
Reference in New Issue
Block a user