diff --git a/zayavka.php b/zayavka.php index 105106d..62ae30a 100644 --- a/zayavka.php +++ b/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'])) {
);"> + echo "100"; +} else { + echo "0"; +} ?>);">
|