mulpiple php mysql fixes
This commit is contained in:
parent
2a2fa40969
commit
30e5a8a516
525
zayavka.php
525
zayavka.php
@ -1,44 +1,77 @@
|
||||
<?php
|
||||
session_start();
|
||||
if(!isset($_SESSION['uid'])) { header("Location: index.php"); }
|
||||
if (!isset($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
}
|
||||
include("config.php");
|
||||
include("functions.php");
|
||||
if($user['battle'] != 0) { header('Location: fbattle.php'); die(); }
|
||||
mysql_query("LOCK TABLES `bots` WRITE, `battle` WRITE, `logs` WRITE, `users` WRITE, `inventory` WRITE, `zayavka` WRITE, `effects` WRITE, `online` WRITE, 'versus' WRITE");
|
||||
if ($user['battle'] != 0) {
|
||||
header('Location: fbattle.php');
|
||||
die();
|
||||
}
|
||||
db::c()->query('LOCK TABLES `bots` WRITE, `battle` WRITE, `logs` WRITE, `users` WRITE, `inventory` WRITE, `zayavka` WRITE, `effects` WRITE, `online` WRITE');
|
||||
|
||||
if (($_GET['do'] == "clear") && (($user['align'] > 1.4 && $user['align'] < 2) || $user['admin'] == 1)) {
|
||||
mysql_query("UPDATE `zayavka` SET `coment` = '<em>Вырезано цензурой!</em>' WHERE `id` = '" . mysql_real_escape_string($_GET['zid']) . "' LIMIT 1");
|
||||
db::c()->query('UPDATE `zayavka` SET `coment` = "?s" WHERE `id` = ?i', '<em>Вырезано цензурой!</em>', $_GET['zid']);
|
||||
|
||||
}
|
||||
|
||||
if ($_GET['del'] && $user['admin'] == 1) { //удаление заявки на бой.
|
||||
$zay = mysql_fetch_array(mysql_query('SELECT `id` FROM `zayavka` WHERE `id` = "' . mysql_real_escape_string((int)$_GET['zid']) . '" LIMIT 1'));
|
||||
if (isset($zay['id'])) {
|
||||
mysql_query("UPDATE `users` SET `zayavka` = 0 WHERE `zayavka` = {$zay['id']}");
|
||||
mysql_query("DELETE FROM `zayavka` WHERE `id` = {$zay['id']} LIMIT 1");
|
||||
$zayavka = db::c()->query('SELECT `id` FROM `zayavka` WHERE `id` = ?i', $_GET['zid'])->fetch_assoc();
|
||||
if (isset($zayavka['id'])) {
|
||||
db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `zayavka` = ?i', $zayavka['id']);
|
||||
db::c()->query('DELETE FROM `zayavka` WHERE `id` = ?i', $zayavka['id']);
|
||||
} else {
|
||||
echo 'Заявка не найдена ...';
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['view'])) {
|
||||
$_SESSION['view'] = $_REQUEST['view'];
|
||||
}
|
||||
if (isset($_REQUEST['view'])) $_SESSION['view'] = $_REQUEST['view'];
|
||||
|
||||
class zayavka {
|
||||
class zayavka
|
||||
{
|
||||
var $mysql;
|
||||
|
||||
function zayavka() {
|
||||
function __construct()
|
||||
{
|
||||
global $mysql;
|
||||
$this->mysql = $mysql;
|
||||
}
|
||||
|
||||
function fteam($team) {
|
||||
function fteam($team)
|
||||
{
|
||||
$team = explode(";", $team);
|
||||
unset($team[count($team) - 1]);
|
||||
return $team;
|
||||
}
|
||||
|
||||
function getlist($razdel = 1, $level = null, $id = null ) {
|
||||
function getlist($razdel = 1, $level = null, $id = null)
|
||||
{
|
||||
/*
|
||||
* if ($level AND $razdel==4 AND $id):
|
||||
* SELECT * FROM `zayavka` WHERE
|
||||
* (`t1min` <= {$level} OR `t1min` = 99) AND
|
||||
* (`t1max` >= {$level} OR `t1max` = 99) AND
|
||||
* (`t2min` <= {$level} OR `t2min` = 99) AND
|
||||
* (`t2max` >= {$level} OR `t2max` = 99) AND
|
||||
* `level` = {$razdel} AND
|
||||
* `id` = {$id}
|
||||
*
|
||||
* if ($level AND $razdel!=4 AND $id):
|
||||
* SELECT * FROM `zayavka` WHERE
|
||||
* (`t1min` <= {$level} OR `t1min` = 99) AND
|
||||
* (`t1max` >= {$level} OR `t1max` = 99) AND
|
||||
* `level` = {$razdel} AND
|
||||
* `id` = {$id}
|
||||
*
|
||||
* if ($level AND $razdel!=4 AND !$id):
|
||||
* SELECT * FROM `zayavka` WHERE
|
||||
* (`t1min` <= {$level} OR `t1min` = 99) AND
|
||||
* (`t1max` >= {$level} OR `t1max` = 99) AND
|
||||
* `level` = {$razdel}
|
||||
*
|
||||
* Пидорасы!
|
||||
*/
|
||||
$fict = mysql_query("SELECT * FROM `zayavka` WHERE " . (($level != null) ? " ((`t1min` <= '{$level}' OR `t1min` = '99') AND (`t1max` >= '{$level}' OR `t1max` = '99') " . (($razdel == 4) ? "AND (`t2min` <= '{$level}' OR `t2min` = '99') AND (`t2max` >= '{$level}' OR `t2max` = '99')" : "") . ") AND " : "") . " `level` = {$razdel} " . (($id != null) ? " AND `id` = {$id} " : "") . " ORDER BY `podan` DESC");
|
||||
while ($row = mysql_fetch_array($fict)) {
|
||||
if (($row['start'] + 300) < time()) {
|
||||
@ -58,18 +91,25 @@ class zayavka {
|
||||
return $zay;
|
||||
}
|
||||
|
||||
function addteam($team = 1, $id, $zay , $r) {
|
||||
function addteam($team = 1, $id, $zay, $r)
|
||||
{
|
||||
global $user;
|
||||
$owntravma = mysql_fetch_array(mysql_query("SELECT `id`, `type` FROM `effects` WHERE `owner` = " . $id . " AND (`type` = 12 OR `type` = 13)"));
|
||||
$z = $this->getlist($r, null, $zay);
|
||||
if ($owntravma) {
|
||||
switch ($owntravma['type']) {
|
||||
case ($owntravma['type'] == 12 && ($z[$zay]['type'] != 4 && $z[$zay]['type'] != 5)): return "У Вас средняя травма, поединки с оружием слишком тяжелы для Вас..."; break;
|
||||
case 13: return "У Вас тяжелая травма, Вы не сможете драться..."; break;
|
||||
case ($owntravma['type'] == 12 && ($z[$zay]['type'] != 4 && $z[$zay]['type'] != 5)):
|
||||
return "У Вас средняя травма, поединки с оружием слишком тяжелы для Вас...";
|
||||
break;
|
||||
case 13:
|
||||
return "У Вас тяжелая травма, Вы не сможете драться...";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($user['zayavka'] != 0) { return "Вы находитесь в заявке"; }
|
||||
if ($user['zayavka'] != 0) {
|
||||
return "Вы находитесь в заявке";
|
||||
}
|
||||
|
||||
if ($user['hp'] < $user['maxhp'] * 0.33) {
|
||||
return "Вы слишком ослаблены для боя, восстановитесь.";
|
||||
@ -79,14 +119,18 @@ class zayavka {
|
||||
return "Эта заявка не может быть принята Вами.";
|
||||
}
|
||||
|
||||
if($this->ustatus($id) != 0) {
|
||||
if ($this->user_status($id) != 0) {
|
||||
return "Эта заявка не может быть принята Вами.";
|
||||
}
|
||||
|
||||
if ($z[$zay]['type'] == 3 || $z[$zay]['type'] == 5) {
|
||||
|
||||
} else {
|
||||
if($team == 1) { $teamz = 2; } else { $teamz = 1; }
|
||||
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) {
|
||||
@ -129,14 +173,17 @@ class zayavka {
|
||||
}
|
||||
}
|
||||
|
||||
if(count($z[$zay]['team'.$team]) >= $z[$zay]['t'.$team.'c'] ) { return "Группа уже набрана."; }
|
||||
if (count($z[$zay]['team' . $team]) >= $z[$zay]['t' . $team . 'c']) {
|
||||
return "Группа уже набрана.";
|
||||
}
|
||||
$z[$zay]['team' . $team][] = '';
|
||||
if (mysql_query("UPDATE `users`, `zayavka` SET `users`.`zayavka` = {$zay}, `zayavka`.`team{$team}` = '" . implode(";", $z[$zay]['team' . $team]) . "" . $id . ";' WHERE `users`.`id` = {$id} AND `users`.`zayavka` = 0 AND `zayavka`.`id` = {$zay}")) {
|
||||
return "Вы приняли заявку на бой.";
|
||||
}
|
||||
}
|
||||
|
||||
function delteam($team = 2, $id, $zay, $r) {
|
||||
function delteam($team = 2, $id, $zay, $r)
|
||||
{
|
||||
$z = $this->getlist($r, null, $zay);
|
||||
if ($z[$zay]['level'] > 3 || $z[$zay]['level'] == null) {
|
||||
return "Ай-ай-ай!";
|
||||
@ -153,53 +200,69 @@ class zayavka {
|
||||
}
|
||||
}
|
||||
|
||||
function addzayavka($start, $timeout = 3, $t1c, $t2c, $type, $t1min, $t2min, $t1max, $t2max, $coment, $creator, $level = 1, $stavka, $blood = 0) {
|
||||
function addzayavka($start, $timeout, $t1c, $t2c, $type, $t1min, $t2min, $t1max, $t2max, $coment, $creator, $level, $stavka, $blood = 0)
|
||||
{
|
||||
global $user;
|
||||
if((int)$level < 1 || (int)$level > 5) return "Ошибка...";
|
||||
if($level == 1 && ($type != 1 && $type != 4)) { $type = 1; }
|
||||
if($level == 2 && ($type != 1 && $type != 4 && $type != 6)) { $type = 1; }
|
||||
if($level == 4 && ($type != 2 && $type != 4)) { $type = 2; }
|
||||
if($level == 5 && ($type != 3 && $type != 5)) { $type = 3; }
|
||||
|
||||
if(!in_array($start, [3,5,10,15,30,45,60])) {$start = 10;}
|
||||
if(!in_array($timeout, [3,4,5,7,10])) {$timeout = 3;}
|
||||
if (!in_array($level, [1, 2, 4, 5])) {
|
||||
$level = 1;
|
||||
} else return "Ошибка!";
|
||||
|
||||
if($this->ustatus($creator) != 0) { exit(); }
|
||||
$owntravma = mysql_fetch_array(mysql_query("SELECT `type`, `id`, `sila`, `lovk`, `inta` FROM `effects` WHERE `owner` = ".$creator." AND (`type` = 12 OR `type` = 13)"));
|
||||
if ($level == 1 AND $type != 1 AND $type != 4) $type = 1;
|
||||
if ($level == 2 AND $type != 1 AND $type != 4 AND $type != 6) $type = 1;
|
||||
if ($level == 4 AND $type != 2 AND $type != 4) $type = 2;
|
||||
if ($level == 5 AND $type != 3 AND $type != 5) $type = 3;
|
||||
// Level 3? Что это? Где это?
|
||||
|
||||
if (!in_array($start, [3, 5, 10, 15, 30, 45, 60])) $start = 10;
|
||||
if (!in_array($timeout, [3, 4, 5, 7, 10])) $timeout = 3;
|
||||
|
||||
if ($this->user_status($creator) != 0) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$owntravma = db::c()->query('SELECT `type` FROM `effects` WHERE `owner` = ?i AND (`type` = 12 OR `type` = 13)', $creator)->fetch_assoc();
|
||||
if ($owntravma) {
|
||||
switch ($owntravma['type']) {
|
||||
case ($owntravma['type'] == 12 && ($type != 4 && $type != 5)): return "У Вас средняя травма, поединки с оружием слишком тяжелы для Вас..."; break;
|
||||
case 13: return "У Вас тяжелая травма, Вы не сможети драться..."; break;
|
||||
case ($owntravma['type'] == 12 && ($type != 4 && $type != 5)):
|
||||
return "У Вас средняя травма, поединки с оружием слишком тяжелы для Вас...";
|
||||
break;
|
||||
case 13:
|
||||
return "У Вас тяжелая травма, Вы не сможети драться...";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$user['klan'] && $t1min == 99) {return "Вы не состоите в клане.";}
|
||||
if($user['hp'] < $user['maxhp']*0.33) {return "Вы слишком ослаблены для боя, восстановитесь.";}
|
||||
if (!$user['klan'] && $t1min == 99) {
|
||||
return "Вы не состоите в клане.";
|
||||
}
|
||||
if ($user['hp'] < $user['maxhp'] * 0.33) {
|
||||
return "Вы слишком ослаблены для боя, восстановитесь.";
|
||||
}
|
||||
|
||||
if ($type == 3) {
|
||||
$fp = fopen ("tmp/chat.txt","a"); //открытие
|
||||
flock ($fp,LOCK_EX); //БЛОКИРОВКА ФАЙЛА
|
||||
fputs($fp ,"\r\n:[".time ()."]:[!sys2all!!]:[<font color=red> Внимание! Подана заявка на хаотический поединок (".$t1min."-".$t1max.") начнется через ".$start." минут.</font>]:[1]\r\n"); //работа с файлом
|
||||
fflush ($fp); //ОЧИЩЕНИЕ ФАЙЛОВОГО БУФЕРА И ЗАПИСЬ В ФАЙЛ
|
||||
flock ($fp,LOCK_UN); //СНЯТИЕ БЛОКИРОВКИ
|
||||
fclose ($fp); //закрытие
|
||||
AddChatSystem('Внимание! Подана заявка на хаотический поединок ({$t1min} - {$t1max}), который начнется через {$start} минут.');
|
||||
}
|
||||
|
||||
$start = time() + $start * 60;
|
||||
$stavka = round($stavka, 2);
|
||||
|
||||
db::c()->query('INSERT INTO `zayavka`
|
||||
(`start`, `timeout`, `t1c`, `t2c`, `type`, `level`, `coment`, `team1`, `stavka`, `t1min`, `t2min`, `t1max`, `t2max`,`podan`,`blood`)
|
||||
VALUES (?i,?i,?i,?i,?i,?i,"?s","?s",?d,?i,?i,?i,?i,"?s",?i)',
|
||||
$start, $timeout, $t1c, $t2c, $type, $level, $coment, $creator, $stavka, $t1min, $t2min, $t1max, $t2max, date('H:i'), $blood);
|
||||
db::c()->query('UPDATE `users` SET `zayavka` = ?i WHERE `id` = ?i', db::c()->getLastInsertId(), $creator);
|
||||
|
||||
mysql_query("INSERT INTO `zayavka`
|
||||
(`start`, `timeout`, `t1c`, `t2c`, `type`, `level`, `coment`, `team1`, `stavka`, `t1min`, `t2min`, `t1max`, `t2max`,`podan`,`blood`) values
|
||||
({$start},{$timeout},{$t1c},{$t2c},{$type},{$level},'{$coment}','{$creator};','{$stavka}',{$t1min}, {$t2min}, {$t1max}, {$t2max}, '".date("H:i")."', '{$blood}');");
|
||||
|
||||
mysql_query("UPDATE `users` SET `zayavka` = ".mysql_insert_id()." WHERE `id` = {$creator} LIMIT 1");
|
||||
return null;
|
||||
}
|
||||
|
||||
function delzayavka($id, $zay, $r, $f = 1) {
|
||||
function delzayavka($id, $zay, $r, $f = 1)
|
||||
{
|
||||
$z = $this->getlist($r, null, $zay);
|
||||
if ($f != 1) {
|
||||
if($z[$zay]['level'] > 3) {return 'Ай-ай-ай!';}
|
||||
if ($z[$zay]['level'] > 3) {
|
||||
return 'Ай-ай-ай!';
|
||||
}
|
||||
}
|
||||
|
||||
if (mysql_query("DELETE FROM `zayavka` WHERE `id` = {$zay} AND (`team1` LIKE '{$id};%' OR `team2` LIKE '{$id};%') LIMIT 1")) {
|
||||
@ -218,7 +281,8 @@ class zayavka {
|
||||
}
|
||||
}
|
||||
|
||||
function showfiz($row) {
|
||||
function showfiz($row)
|
||||
{
|
||||
global $user;
|
||||
$rr = "<input type=\"radio\" " . ((in_array($user['id'], $row['team1']) || in_array($user['id'], $row['team2']) || $row['team2']) ? "disabled " : "") . " name=\"gocombat\" value=\"{$row['id']}\" /><font class=date>{$row['podan']}</font> ";
|
||||
|
||||
@ -245,7 +309,8 @@ class zayavka {
|
||||
return $rr;
|
||||
}
|
||||
|
||||
function showgroup($row) {
|
||||
function showgroup($row)
|
||||
{
|
||||
if ($row['t1min'] == 99) {
|
||||
$range1 = "<i>клан</i>";
|
||||
} else {
|
||||
@ -260,24 +325,30 @@ class zayavka {
|
||||
|
||||
$rr = "<input type=\"radio\" " . ((in_array($user['id'], $row['team1']) || in_array($user['id'], $row['team2'])) ? "disabled " : "") . " name=\"gocombat\" value=\"{$row['id']}\"><font class=date>{$row['podan']}</font> <b>{$row['t1c']}</b>({$range1}) (";
|
||||
foreach ($row['team1'] as $k => $v) {
|
||||
if($k != 0) { $rr .= ", "; }
|
||||
if ($k != 0) {
|
||||
$rr .= ", ";
|
||||
}
|
||||
$rr .= nick::id($v)->full(1);
|
||||
}
|
||||
|
||||
$rr .= ") <i>против</i> <b>{$row['t2c']}</b>({$range2})(";
|
||||
|
||||
foreach ($row['team2'] as $k => $v) {
|
||||
if($k != 0) { $rr .= ", "; }
|
||||
if ($k != 0) {
|
||||
$rr .= ", ";
|
||||
}
|
||||
$rr .= nick::id($v)->full(1);
|
||||
}
|
||||
|
||||
if(count($row['team2']) ==0) { $rr .= "<i>группа не набрана</i>"; }
|
||||
if (count($row['team2']) == 0) {
|
||||
$rr .= "<i>группа не набрана</i>";
|
||||
}
|
||||
|
||||
if ($row['blood'] && $row['type'] == 5) {
|
||||
$rr .= "<img src=\"i/fighttype6.gif\" width=\"20\" height=\"20\" />";
|
||||
}
|
||||
|
||||
$ali = mysql_fetch_array(mysql_query("SELECT `align` FROM `users` WHERE `id` = '{$user['id']}' LIMIT 1"));
|
||||
$a = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = ?i', $user['id'])->fetch_assoc();
|
||||
$rr .= ") тип боя: ";
|
||||
|
||||
if ($row['blood'] && $row['type'] == 4) {
|
||||
@ -292,27 +363,33 @@ class zayavka {
|
||||
|
||||
$rr .= "(таймаут {$row['timeout']} мин.) <span style='color: gray;'><i>бой начнется через " . round(($row['start'] - time()) / 60, 1) . " мин. " . (($row['coment']) ? "(" . $row['coment'] . ")" : "") . "</i></span>";
|
||||
|
||||
if(($ali['align'] > 1.4 && $ali['align'] < 2) || ($ali['align'] > 2 && $ali['align'] < 3)) {
|
||||
$rr .= "<a href='?zid={$row['id']}&do=clear'><img src='i/clear.gif'></a><br />";
|
||||
if (($a['align'] > 1.4 && $a['align'] < 2) || $a['admin'] == 1) {
|
||||
$rr .= "<a href='?zid={$row['id']}&do=clear'><small>Удалить комментарий</small></a><br />";
|
||||
} else {
|
||||
$rr .= "<br />";
|
||||
}
|
||||
return $rr;
|
||||
}
|
||||
|
||||
function showhaos($row) {
|
||||
function showhaos($row)
|
||||
{
|
||||
global $user;
|
||||
$rs = '';
|
||||
$rr = "<input type=\"radio\" " . ((in_array($user['id'], $row['team1']) || in_array($user['id'], $row['team2'])) ? "disabled " : "") . " name=\"gocombat\" value=\"{$row['id']}\" /><font class=\"date\">{$row['podan']}</font> (";
|
||||
|
||||
if ($row['bots'] == '7') {
|
||||
$rr .= nick::id(10962)->full(1); $rr .= ", ";
|
||||
$rr .= nick::id(10964)->full(1); $rr .= ", ";
|
||||
$rr .= nick::id(10965)->full(1); $rr .= ", ";
|
||||
$rr .= nick::id(10962)->full(1);
|
||||
$rr .= ", ";
|
||||
$rr .= nick::id(10964)->full(1);
|
||||
$rr .= ", ";
|
||||
$rr .= nick::id(10965)->full(1);
|
||||
$rr .= ", ";
|
||||
} elseif ($row['bots'] == '8' || $row['bots'] == '13') {
|
||||
$rr .= nick::id(10124)->full(1); $rr .= ", ";
|
||||
$rr .= nick::id(10125)->full(1); $rr .= ", ";
|
||||
$rr .= nick::id(10126)->full(1); $rr .= ", ";
|
||||
$rr .= nick::id(10124)->full(1);
|
||||
$rr .= ", ";
|
||||
$rr .= nick::id(10125)->full(1);
|
||||
$rr .= ", ";
|
||||
$rr .= nick::id(10126)->full(1);
|
||||
$rr .= ", ";
|
||||
}
|
||||
|
||||
foreach ($row['team1'] as $k => $v) {
|
||||
@ -322,7 +399,9 @@ class zayavka {
|
||||
$rr .= nick::id($v)->full(1);
|
||||
}
|
||||
|
||||
if(count($row['team1']) == 0 && $row['bots'] == 0) { $rr.= "<i>группа не набрана</i>"; }
|
||||
if (count($row['team1']) == 0 && $row['bots'] == 0) {
|
||||
$rr .= "<i>группа не набрана</i>";
|
||||
}
|
||||
|
||||
$rr .= ") ({$row['t1min']}-{$row['t1max']}) тип боя: ";
|
||||
if ($row['blood'] && $row['type'] == 5) {
|
||||
@ -337,24 +416,25 @@ class zayavka {
|
||||
|
||||
$rr .= "(таймаут {$row['timeout']} мин.) <span style='color: gray;'><i >бой начнется через " . round(($row['start'] - time()) / 60, 1) . " мин. " . (($row['coment']) ? "(" . $row['coment'] . ")" : "") . "</i></span>";
|
||||
|
||||
if($user['align'] == '2.99') {
|
||||
$rsr = ' <a href=\'?level=haos&zid='.$row['id'].'&del=true\'>Удалить заявку</a>';
|
||||
if ($user['admin'] == 1) {
|
||||
$rsr = ' | <a href=\'?level=haos&zid=' . $row['id'] . '&del=true\'>Удалить заявку</a>';
|
||||
} else {
|
||||
$rsr = '';
|
||||
}
|
||||
|
||||
if(($user['align'] > 1.4 && $user['align'] < 2) || ($user['align'] > 2 && $user['align'] < 3)) {
|
||||
$rr .= "<a href='?zid={$row['id']}&do=clear'><img src='i/clear.gif'></a>$rsr<br />";
|
||||
if (($user['align'] > 1.4 && $user['align'] < 2) || $user['admin'] == 1) {
|
||||
$rr .= "<small><a href='?zid={$row['id']}&do=clear'>Удалить коммнтарий</a>$rsr</small><br />";
|
||||
} else {
|
||||
$rr .= "<br />";
|
||||
}
|
||||
return $rr;
|
||||
}
|
||||
|
||||
function ustatus($id) {
|
||||
$fict = mysql_fetch_array(mysql_query("SELECT * FROM `zayavka`, `users` WHERE `users`.`id` = '".$id."' AND `zayavka`.`id` = `users`.`zayavka` LIMIT 1"));
|
||||
$t1 = $this->fteam($fict['team1']);
|
||||
$t2 = $this->fteam($fict['team2']);
|
||||
function user_status($id)
|
||||
{
|
||||
$r = db::c()->query('SELECT `team1`,`team2` FROM `zayavka`, `users` WHERE `users`.`id` = ?i AND `zayavka`.`id` = `users`.`zayavka`', $id)->fetch_assoc();
|
||||
$t1 = $this->fteam($r['team1']);
|
||||
$t2 = $this->fteam($r['team2']);
|
||||
if (in_array($id, $t1)) {
|
||||
return 1;
|
||||
} elseif (in_array($id, $t2)) {
|
||||
@ -364,10 +444,13 @@ class zayavka {
|
||||
}
|
||||
}
|
||||
|
||||
function battlestart($id, $zay, $r) {
|
||||
function battlestart($id, $zay, $r)
|
||||
{
|
||||
global $user;
|
||||
$z = $this->getlist($r, null, $zay);
|
||||
if($id == 'CHAOS') { $id = $z[$zay]['team1'][0]; }
|
||||
if ($id == 'CHAOS') {
|
||||
$id = $z[$zay]['team1'][0];
|
||||
}
|
||||
$this->delzayavka($id, $zay, $r);
|
||||
$z = $z[$zay];
|
||||
$count_users = count($z['team1']);
|
||||
@ -406,21 +489,24 @@ class zayavka {
|
||||
|
||||
if ($z['type'] == 3 || $z['type'] == 5) {
|
||||
if ($count_users < 4) {
|
||||
mysql_query("UPDATE `users` SET `zayavka` = 0 WHERE `zayavka` = '".$zay."'");
|
||||
db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `zayavka` = ?i', $zay);
|
||||
foreach ($z['team1'] as $k => $v) {
|
||||
if ($v < _BOTSEPARATOR_) {
|
||||
addchp('<font color=red>Внимание!</font> Ваш бой не может начаться по причине <b>Группа не набрана</b>.', '{[]}'.nick::id($v)->short().'{[]}');
|
||||
//TODO Написать добавлялку в чат для определённого чеговека. Плясать от AddChatSystem().
|
||||
#addchp('<font color=red>Внимание!</font> Ваш бой не может начаться по причине <b>Группа не набрана</b>.', '{[]}' . nick::id($v)->short() . '{[]}');
|
||||
die('Bitch');
|
||||
}
|
||||
}
|
||||
mysql_query("UPDATE `variables` SET `value` = '{$count_users}}' WHERE `var` = 'haos_match' LIMIT 1");
|
||||
mysql_query("DELETE FROM `zayavka` WHERE `id` = '".$zay."' LIMIT 1");
|
||||
db::c()->query('UPDATE `variables` SET `value` = ?i WHERE `var` = "?s"', $count_users, 'haos_match');
|
||||
db::c()->query('DELETE FROM `zayavka` WHERE `id` = ?i', $zay);
|
||||
header("Location: zayavka.php");
|
||||
}
|
||||
|
||||
$all = count($z['team1']) - 1;
|
||||
$power1 = 0; $power2 = 0;
|
||||
$power1 = 0;
|
||||
$power2 = 0;
|
||||
|
||||
// А ЭТО ещё что за хренотень?! О_о
|
||||
for ($i = 0; $i <= $all; $i++) {
|
||||
if ($z['team1'][$i] < _BOTSEPARATOR_) {
|
||||
$gamer = mysql_fetch_array(mysql_query("SELECT (`level`*50)+`sila`+`lovk`+`inta`+`vinos`+`intel`+`stats`+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0) FROM `users` WHERE `id` = '" . $z['team1'][$i] . "' LIMIT 1"));
|
||||
@ -475,43 +561,54 @@ class zayavka {
|
||||
}
|
||||
|
||||
if (count($z['team2']) == 0) {
|
||||
mysql_query("UPDATE `users` SET `zayavka` = 0 WHERE `zayavka` = '".$zay."'");
|
||||
db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `zayavka` = ?i', $zay);
|
||||
db::c()->query('DELETE FROM `zayavka` WHERE `id` = ?i', $zay);
|
||||
foreach ($z['team1'] as $k => $v) {
|
||||
addchp('<font color=red>Внимание!</font> Ваш бой не может начаться по причине "Группа не набрана".', '{[]}'.nick::id($v)->short().'{[]}');
|
||||
//TODO Написать добавлялку в чат для определённого чеговека. Плясать от AddChatSystem().[2]
|
||||
#addchp('<font color=red>Внимание!</font> Ваш бой не может начаться по причине "Группа не набрана".', '{[]}' . nick::id($v)->short() . '{[]}');
|
||||
return null;
|
||||
}
|
||||
mysql_query("DELETE FROM `zayavka` WHERE `id` = '".$zay."' LIMIT 1");
|
||||
header("Location: zayavka.php");
|
||||
die();
|
||||
}
|
||||
|
||||
if($z['timeout'] == 3 || $z['timeout'] == 4 || $z['timeout'] == 5 || $z['timeout'] == 7 || $z['timeout'] == 10) {
|
||||
|
||||
} else {
|
||||
$z['timeout'] = 3;
|
||||
}
|
||||
if (!in_array($z['timeout'], [3, 4, 5, 7, 10])) $z['timeout'] = 3;
|
||||
|
||||
if (count($teams) > 1) {
|
||||
if ($z['type'] == 1 || $z['type'] == 4) {
|
||||
$rs = ', `fiz`'; $rss = ', 1';
|
||||
$rs = ', `fiz`';
|
||||
$rss = ', 1';
|
||||
} else {
|
||||
$rs = ''; $rss = '';
|
||||
$rs = '';
|
||||
$rss = '';
|
||||
}
|
||||
mysql_query("INSERT INTO `battle` (`coment`, `teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`, `blood`$rs, `bots`) VALUES ('{$z['coment']}', '".serialize($teams)."', '{$z['timeout']}', '{$z['type']}', '0', '".implode(";", $z['team1'])."', '".implode(";", $z['team2'])."', '".time()."', '".time()."', '".$z['blood']."'$rss, '".$z['bots']."')");
|
||||
$id = mysql_insert_id();
|
||||
|
||||
db::c()->query('
|
||||
INSERT INTO `battle` (`coment`, `teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`, ?f, `bots`)
|
||||
VALUES ("?s","?s",?i,?i,?i,"?s","?s",?i,?i,?i,?i)',
|
||||
'blood' . $rs, $z['coment'], serialize($teams), $z['timeout'], $z['type'], 0, implode(';', $z['team1']), implode(';', $z['team2']), time(), time(), $z['blood'], $rss, $z['bots']);
|
||||
$id = db::c()->getLastInsertId();
|
||||
|
||||
$rr = "<b>";
|
||||
|
||||
foreach ($z['team1'] as $k => $v) {
|
||||
if($k != 0) { $rr .= ", "; }
|
||||
if ($k != 0) {
|
||||
$rr .= ", ";
|
||||
}
|
||||
$rr .= nick::id($v)->full(1);
|
||||
addchp('<font color=red>Внимание!</font> Ваш бой начался!<br />\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ', '{[]}'.nick::id($v)->short().'{[]}');
|
||||
//TODO Написать добавлялку в чат для определённого чеговека. Плясать от AddChatSystem().[3]
|
||||
#addchp('<font color=red>Внимание!</font> Ваш бой начался!<br />\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ', '{[]}' . nick::id($v)->short() . '{[]}');
|
||||
}
|
||||
|
||||
$rr .= "</b> и <b>";
|
||||
|
||||
foreach ($z['team2'] as $k => $v) {
|
||||
if($k != 0) { $rr .= ", "; }
|
||||
if ($k != 0) {
|
||||
$rr .= ", ";
|
||||
}
|
||||
$rr .= nick::id($v)->full(1);
|
||||
addchp('<font color=red>Внимание!</font> Ваш бой начался!<br />\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ', '{[]}'.nick::id($v)->short().'{[]}');
|
||||
//TODO Написать добавлялку в чат для определённого чеговека. Плясать от AddChatSystem().[4]
|
||||
#addchp('<font color=red>Внимание!</font> Ваш бой начался!<br />\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ', '{[]}' . nick::id($v)->short() . '{[]}');
|
||||
}
|
||||
|
||||
$rr .= "</b>";
|
||||
@ -519,28 +616,27 @@ class zayavka {
|
||||
|
||||
foreach ($z['team1'] as $k => $v) {
|
||||
if ($v < _BOTSEPARATOR_) {
|
||||
mysql_query("UPDATE `users` SET `battle` = {$id}, `zayavka` = 0 WHERE `id` = {$v}");
|
||||
db::c()->query('UPDATE `users` SET `battle` = ?i, `zayavka` = 0 WHERE `id` = ?i',$id, $v);
|
||||
} else {
|
||||
mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$v}");
|
||||
db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i',$id, $v);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($z['team2'] as $k => $v) {
|
||||
if ($v < _BOTSEPARATOR_) {
|
||||
mysql_query("UPDATE `users` SET `battle` = {$id}, `zayavka` = 0 WHERE `id` = {$v}");
|
||||
db::c()->query('UPDATE `users` SET `battle` = ?i, `zayavka` = 0 WHERE `id` = ?i',$id, $v);
|
||||
} else {
|
||||
mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$v}");
|
||||
db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i',$id, $v);
|
||||
}
|
||||
}
|
||||
if ($bot) {
|
||||
mysql_query("UPDATE `bots` SET `battle` = '$id' WHERE `id` = '$bot[id]'");
|
||||
db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i',$id, $bot['id']);
|
||||
}
|
||||
}
|
||||
if ($user['zayavka'] == $zay) {
|
||||
die("<script>location.href='fbattle.php';</script>");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$zay = new zayavka;
|
||||
@ -553,67 +649,87 @@ if($_POST['open']) {
|
||||
?>
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<link rel=stylesheet type="text/css" href="css/main.css">
|
||||
<meta content="text/html; charset=utf-8" http-equiv=Content-type>
|
||||
<META Http-Equiv=Cache-Control Content=no-cache>
|
||||
<meta http-equiv=PRAGMA content=NO-CACHE>
|
||||
<META Http-Equiv=Expires Content=0>
|
||||
<link rel=stylesheet href="css/main.css">
|
||||
<meta charset=utf-8">
|
||||
<style>
|
||||
.m {background: #99CCCC;text-align: center;}
|
||||
.s {background: #BBDDDD;text-align: center;}
|
||||
.m {
|
||||
background: #99CCCC;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.s {
|
||||
background: #BBDDDD;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function refreshPeriodic()
|
||||
{
|
||||
<?if ($_REQUEST['logs'] == null) {?>location.href='zayavka.php?level=<?=$_REQUEST['level']?>&tklogs=<?=$_REQUEST['tklogs']?>&logs=<?=$_REQUEST['logs']?>';//reload();
|
||||
<?}?>
|
||||
function refreshPeriodic() {
|
||||
<?php if ($_REQUEST['logs'] == null): ?>
|
||||
location.href = 'zayavka.php?level=<?= $_REQUEST['level'] ?>&tklogs=<?= $_REQUEST['tklogs'] ?>&logs=<?= $_REQUEST['logs'] ?>';
|
||||
<? endif; ?>
|
||||
timerID = setTimeout("refreshPeriodic()", 30000);
|
||||
}
|
||||
|
||||
timerID = setTimeout("refreshPeriodic()", 30000);
|
||||
</script>
|
||||
</HEAD>
|
||||
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=e2e0e0 onload="top.setHP(<?=$user['hp']?>,<?=$user['maxhp']?>,<?if (!$user['battle']){echo"100";}else{echo"0";}?>);">
|
||||
<body onload="top.setHP(<?= $user['hp'] ?>,<?= $user['maxhp'] ?>,<?php if (!$user['battle']) {
|
||||
echo "100";
|
||||
} else {
|
||||
echo "0";
|
||||
} ?>);">
|
||||
<TABLE width=100% cellspacing=1 cellpadding=1>
|
||||
<FORM METHOD=POST ACTION=zayavka.php name=F1>
|
||||
<FORM METHOD=POST name=F1>
|
||||
<TR>
|
||||
<TD colspan=5>
|
||||
<? if ($_REQUEST['level']) { echo nick($user); } ?>
|
||||
<?php if ($_REQUEST['level']) echo nick($user); ?>
|
||||
</TD>
|
||||
<TD colspan=4 align=right>
|
||||
<INPUT TYPE=button value="Подсказка" style="background-color:#A9AFC0" onclick="window.open('help/combats.html', 'help', 'height=300,width=500,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes')">
|
||||
<INPUT TYPE=button value="Вернуться" onclick="location.href='main.php?top=0.467837356797105';">
|
||||
<INPUT TYPE=button value="Вернуться" onclick="location.href='main.php?top=<?= mt_rand() ?>';">
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD class=m width=40> <B><?php if ($user['room'] != 101) echo 'Бои:'; else echo 'Разделы:'; ?></B></TD>
|
||||
<TD class=<?=($_REQUEST['level']=='begin')?"s":"m"?>><?php if($user['room'] != 101) echo ("<A HREF=\"zayavka.php?level=begin&0.467837356797105\">Новичков</A></TD>"); else echo 'Зал Славы Тьмы</TD>'?>
|
||||
<TD class=<?=($_REQUEST['level']=='fiz')?"s":"m"?>><?php if($user['room'] != 101) echo ("<A HREF=\"zayavka.php?level=fiz&0.467837356797105\">Физические</A></TD>"); else echo 'Зал Славы Света</TD>'?>
|
||||
<TD class=<?=($_REQUEST['level']=='dgv')?"s":"m"?>><?php if($user['room'] != 101) echo ("<A HREF=\"zayavka.php?level=dgv&0.467837356797105\">Договорные</A></TD>"); else echo 'Квесты</TD>'?>
|
||||
<TD class=<?=($_REQUEST['level']=='group')?"s":"m"?>><A HREF="zayavka.php?level=group&0.467837356797105">
|
||||
<?php if($user['room'] != 101) {echo ("Групповые");} else {echo("<font color=red><b>Тьма vs Свет</b></font>");};?>
|
||||
<?php //FIXME Убрать этот адов пиздец, когда одни и те же ссылки ведут в разные места и называются по разному. Или нормально понять зачем это. ?>
|
||||
<TD class=<?= ($_REQUEST['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=<?= ($_REQUEST['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=<?= ($_REQUEST['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=<?= ($_REQUEST['level'] == 'group') ? "s" : "m" ?>><A HREF="zayavka.php?level=group&<?= mt_rand() ?>">
|
||||
<?php if ($user['room'] != 101) {
|
||||
echo("Групповые");
|
||||
} else {
|
||||
echo("<font color=red><b>Тьма vs Свет</b></font>");
|
||||
}; ?>
|
||||
</A></TD>
|
||||
<TD class=<?=($_REQUEST['level']=='haos')?"s":"m"?>><?php if($user['room'] != 101) echo ("<A HREF=\"zayavka.php?level=haos&0.467837356797105\">Хаотичные</A></TD>"); else echo 'В разработке</TD>'?>
|
||||
<TD class=<?=($_REQUEST['tklogs']=='1')?"s":"m"?>><A HREF="zayavka.php?tklogs=1&0.467837356797105">Текущие</A></TD>
|
||||
<TD class=<?=($_REQUEST['logs']!=null)?"s":"m"?>><A HREF="zayavka.php?logs=<?=date("d.m.y")?>&0.467837356797105">Завершенные</A></TD>
|
||||
<TD class=<?= ($_REQUEST['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=<?= ($_REQUEST['tklogs'] == '1') ? "s" : "m" ?>><A HREF="zayavka.php?tklogs=1&<?= mt_rand() ?>">Текущие</A>
|
||||
</TD>
|
||||
<TD class=<?= ($_REQUEST['logs'] != null) ? "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>
|
||||
<?
|
||||
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 && !$_REQUEST['tklogs'] && !$_REQUEST['logs']) {
|
||||
echo "<BR><BR><BR><CENTER><B>В этой комнате невозможно подавать заявки</b></CENTER>";
|
||||
die();
|
||||
}
|
||||
<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 !$_REQUEST['logs'] AND !$_REQUEST['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 && !$_REQUEST['tklogs'] && !$_REQUEST['logs']) {
|
||||
// echo "<BR><BR><BR><CENTER><B>В этой комнате невозможно подавать заявки</b></CENTER>";
|
||||
// die();
|
||||
// }
|
||||
|
||||
if (!$_REQUEST['level'] && !$_REQUEST['tklogs'] && !$_REQUEST['logs']) {
|
||||
echo "<BR><BR><BR><CENTER><B>Выберите раздел</b></CENTER>";
|
||||
}
|
||||
|
||||
if ($_REQUEST['level'] == 'begin') {
|
||||
if($user['level']>0) {die("<BR><BR><BR><CENTER><B>Вы уже выросли из ползунков ;)</b></CENTER>");}
|
||||
if ($user['level'] > 0) {
|
||||
die("<BR><BR><BR><CENTER><B>Вы уже выросли из ползунков ;)</b></CENTER>");
|
||||
}
|
||||
|
||||
//FIXME: Всем функциям прописать return и отказаться от лишних строк.
|
||||
echo "<font color=red><b>";
|
||||
if ($_POST['open']) {
|
||||
echo $zay->addzayavka(0, $_POST['timeout'], 1, 1, $_POST['k'], $user['level'], 1, $user['level'], 21, '', $user['id'], 1, 0);
|
||||
@ -644,20 +760,19 @@ if ($_REQUEST['level'] == 'begin') {
|
||||
}
|
||||
echo "</b></font>";
|
||||
|
||||
echo '<table cellspacing=0 cellpadding=0><tr><td>';
|
||||
echo '<table><tr><td>';
|
||||
$z = $zay->getlist(1, null, $user['zayavka']);
|
||||
if( $zay->ustatus($user['id'])==0 ) {
|
||||
if ($zay->user_status($user['id']) == 0) {
|
||||
//if ($z[$user['zayavka']]['level'] == 1)
|
||||
|
||||
{
|
||||
echo '<FIELDSET><LEGEND><B>Подать заявку на бой</B> </LEGEND>Таймаут <SELECT NAME=timeout><OPTION value=3>3 мин.<OPTION value=4>4 мин.<OPTION value=5>5 мин.<OPTION value=7>7 мин.<OPTION value=10 selected>10 мин.</SELECT> Тип боя <SELECT NAME=k><OPTION value=1>с оружием<OPTION value=4>кулачный</SELECT><INPUT TYPE=submit name=open value="Подать заявку"> </FIELDSET>';
|
||||
};
|
||||
}
|
||||
if( $zay->ustatus($user['id'])==1 ) {
|
||||
if ($zay->user_status($user['id']) == 1) {
|
||||
if (count($z[$user['zayavka']]['team2']) > 0) {
|
||||
echo "<B><font color=red>Внимание! " . nick::id($z[$user['zayavka']]['team2'][0])->full(1) . " принял заявку на бой, нужно отказать или принять вызов.</font></b> <input type=submit value='Битва!' name=gofi> <input type=submit value='Отказать' name=cansel>";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($z[$user['zayavka']]['level'] == 1)
|
||||
echo "Заявка на бой подана, ожидаем противника. <input type=submit name=back value='Отозвать заявку'>";
|
||||
$Path = "/tmp/zayavka/" . $user['id'] . ".txt";
|
||||
@ -697,12 +812,13 @@ if ($_REQUEST['level'] == 'begin') {
|
||||
} else {
|
||||
echo $user['level'];
|
||||
}
|
||||
if($user['level'] == 0) {echo " или <input type=button onclick=\"location.href='zayavka.php?level=begin&trainstart=1';\" value=\"Начать тренировочный бой\">";}
|
||||
|
||||
if ($user['level'] == 0) {
|
||||
echo " или <input type=button onclick=\"location.href='zayavka.php?level=begin&trainstart=1';\" value=\"Начать тренировочный бой\">";
|
||||
}
|
||||
}
|
||||
}
|
||||
if( $zay->ustatus($user['id'])==2 ) {
|
||||
}
|
||||
if ($zay->user_status($user['id']) == 2) {
|
||||
if ($z[$user['zayavka']]['level'] == 1)
|
||||
echo "Ожидаем подтверждения боя. <input type=submit name=back2 value='Отозвать заявку'>";
|
||||
}
|
||||
@ -716,9 +832,10 @@ if ($_REQUEST['level'] == 'begin') {
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($_REQUEST['level'] == 'fiz') {
|
||||
if($user['level']==0) {die("<BR><BR><BR><CENTER><B>Физические бои доступны с 1 уровня.</b></CENTER>");}
|
||||
if ($user['level'] == 0) {
|
||||
die("<BR><BR><BR><CENTER><B>Физические бои доступны с 1 уровня.</b></CENTER>");
|
||||
}
|
||||
|
||||
echo "<font color=red><b>";
|
||||
if ($_POST['open']) {
|
||||
@ -759,15 +876,14 @@ if ($_REQUEST['level'] == 'fiz') {
|
||||
}
|
||||
echo "</b></font>";
|
||||
echo '<table cellspacing=0 cellpadding=0><tr><td>';
|
||||
if( $zay->ustatus($user['id'])==0 ) {
|
||||
if ($zay->user_status($user['id']) == 0) {
|
||||
echo '<FIELDSET><LEGEND><B>Подать заявку на бой</B> </LEGEND>Таймаут <SELECT NAME=timeout><OPTION value=3>3 мин.<OPTION value=4>4 мин.<OPTION value=5>5 мин.<OPTION value=7>7 мин.<OPTION value=10 selected>10 мин.</SELECT> Тип боя <SELECT NAME=k><OPTION value=1>с оружием<OPTION value=4>кулачный<OPTION value=6>кровавый</SELECT><INPUT TYPE=submit name=open value="Подать заявку"> </FIELDSET>';
|
||||
}
|
||||
$z = $zay->getlist(2, null, $user['zayavka']);
|
||||
if( $zay->ustatus($user['id'])==1 ) {
|
||||
if ($zay->user_status($user['id']) == 1) {
|
||||
if (count($z[$user['zayavka']]['team2']) > 0) {
|
||||
echo "<B><font color=red>Внимание! " . nick::id($z[$user['zayavka']]['team2'][0])->full(1) . " принял заявку на бой, нужно отказать или принять вызов.</font></b> <input type=submit value='Битва!' name=gofi> <input type=submit value='Отказать' name=cansel>";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($z[$user['zayavka']]['level'] == 2) {
|
||||
echo "Заявка на бой подана, ожидаем противника. <input type=submit name=back value='Отозвать заявку'>";
|
||||
$Path = "/tmp/zayavka/" . $user['id'] . ".txt";
|
||||
@ -813,7 +929,7 @@ if ($_REQUEST['level'] == 'fiz') {
|
||||
}
|
||||
}
|
||||
}
|
||||
if( $zay->ustatus($user['id'])==2 ) {
|
||||
if ($zay->user_status($user['id']) == 2) {
|
||||
if ($z[$user['zayavka']]['level'] == 2)
|
||||
echo "Ожидаем подтверждения боя. <input type=submit name=back2 value='Отозвать заявку'>";
|
||||
}
|
||||
@ -827,9 +943,10 @@ if ($_REQUEST['level'] == 'fiz') {
|
||||
}
|
||||
|
||||
if ($_REQUEST['level'] == 'group') {
|
||||
if($user['level']<2) {die("<BR><BR><BR><CENTER><B>Групповые бои доступны с 2 уровня.</b></CENTER>");}
|
||||
if($_POST['open1'] && !$user['zayavka'])
|
||||
{
|
||||
if ($user['level'] < 2) {
|
||||
die("<BR><BR><BR><CENTER><B>Групповые бои доступны с 2 уровня.</b></CENTER>");
|
||||
}
|
||||
if ($_POST['open1'] && !$user['zayavka']) {
|
||||
// room 101 - противостояние сил
|
||||
echo '<TABLE><TR><TD>
|
||||
<H3>Подать заявку на групповой бой</H3>
|
||||
@ -922,28 +1039,30 @@ if ($_REQUEST['level'] == 'group') {
|
||||
$vs_test = mysql_fetch_array(mysql_query("SELECT * FROM zayavka where id='{$z[$_POST['gocombat']]['id']}' limit 1 "));
|
||||
|
||||
|
||||
if($user['room'] != 101)
|
||||
{if ($vs_test['versus']==0)
|
||||
{
|
||||
if ($user['room'] != 101) {
|
||||
if ($vs_test['versus'] == 0) {
|
||||
$raid_t = mysql_fetch_array(mysql_query("SELECT * FROM variables WHERE var='raid_on_status' limit 1;"));
|
||||
if ($z[$_POST['gocombat']]['team1'][0] != 1000 && $z[$_POST['gocombat']]['team1'][0] != 1001)
|
||||
echo '<TD align=center><INPUT TYPE=submit name=confirm1 value="Я за этих!"></TD>';
|
||||
else echo '<TD align=center>Силы Хаоса</TD>';
|
||||
}
|
||||
else echo '<TD align=center>Войдите в комнату "Противостояние", чтобы принять эту заявку!</TD>';}
|
||||
else
|
||||
{
|
||||
if(($user['align']==6)||($user['align']==2.1)||($user['align']==2.99)||(($user['align']>7)&&($user['align']<8))||($user['align']==2))
|
||||
{echo '<TD align=center><INPUT TYPE=submit name=confirm1 value="Я за Свет!"></TD>';};
|
||||
if(($user['align']==2.1)||($user['align']==6))
|
||||
{echo '<TD align=center></TD>';};
|
||||
} else echo '<TD align=center>Войдите в комнату "Противостояние", чтобы принять эту заявку!</TD>';
|
||||
} else {
|
||||
if (($user['align'] == 6) || ($user['align'] == 2.1) || ($user['align'] == 2.99) || (($user['align'] > 7) && ($user['align'] < 8)) || ($user['align'] == 2)) {
|
||||
echo '<TD align=center><INPUT TYPE=submit name=confirm1 value="Я за Свет!"></TD>';
|
||||
};
|
||||
if (($user['align'] == 2.1) || ($user['align'] == 6)) {
|
||||
echo '<TD align=center></TD>';
|
||||
};
|
||||
};
|
||||
|
||||
if ($user['room'] != 101) {
|
||||
if ($vs_test['versus']==0) {echo '<TD align=center><INPUT TYPE=submit name=confirm2 value="Я за этих!"></TD>';}
|
||||
else echo '<TD align=center></TD>';
|
||||
if ($vs_test['versus'] == 0) {
|
||||
echo '<TD align=center><INPUT TYPE=submit name=confirm2 value="Я за этих!"></TD>';
|
||||
} else echo '<TD align=center></TD>';
|
||||
} else {
|
||||
if(($user['align']==2.2)||($user['align']==3)) {echo '<TD align=center></TD>';};
|
||||
if (($user['align'] == 2.2) || ($user['align'] == 3)) {
|
||||
echo '<TD align=center></TD>';
|
||||
};
|
||||
if (($user['align'] == 3) || ($user['align'] == 2.2) || ($user['align'] == 2.99) || (($user['align'] > 7) && ($user['align'] < 8)) || ($user['align'] == 2)) {
|
||||
echo '<TD align=center><INPUT TYPE=submit name=confirm2 value="Я за Тьму!"></TD>';
|
||||
};
|
||||
@ -955,8 +1074,12 @@ if ($_REQUEST['level'] == 'group') {
|
||||
|
||||
echo "<font color=red><b>";
|
||||
|
||||
if(($_POST['confirm1']) && $_POST['gocombat'] && !$user['zayavka']) {echo $zay->addteam (1,$user['id'], $_REQUEST['gocombat'], 4);}
|
||||
if(($_POST['confirm2']) && $_POST['gocombat'] && !$user['zayavka']) {echo $zay->addteam (2,$user['id'], $_REQUEST['gocombat'], 4);}
|
||||
if (($_POST['confirm1']) && $_POST['gocombat'] && !$user['zayavka']) {
|
||||
echo $zay->addteam(1, $user['id'], $_REQUEST['gocombat'], 4);
|
||||
}
|
||||
if (($_POST['confirm2']) && $_POST['gocombat'] && !$user['zayavka']) {
|
||||
echo $zay->addteam(2, $user['id'], $_REQUEST['gocombat'], 4);
|
||||
}
|
||||
|
||||
if ($_POST['open'] && !$user['zayavka']) {
|
||||
//print_r($_REQUEST);
|
||||
@ -1038,27 +1161,22 @@ if ($_REQUEST['level'] == 'group') {
|
||||
} else {
|
||||
$blood = 0;
|
||||
}
|
||||
if ($_POST['nlogin1'] == 1 && $_POST['nlogin2'] == 1)
|
||||
{
|
||||
if ($_POST['nlogin1'] == 1 && $_POST['nlogin2'] == 1) {
|
||||
echo "Не надо превращать групповой бой в физический поединок";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
echo $zay->addzayavka($_POST['startime'] / 60, $_POST['timeout'], $_POST['nlogin1'], $_POST['nlogin2'], $_POST['k'], $min1, $min2, $max1, $max2, $_POST['cmt'], $user['id'], 4, 0, $blood);
|
||||
}
|
||||
}
|
||||
/////////////////////////////////
|
||||
echo "</font></b><INPUT TYPE=hidden name=level value=group>";
|
||||
echo '<table cellspacing=0 cellpadding=0><tr><td>';
|
||||
if( $zay->ustatus($user['id'])==0 )
|
||||
if(($user['room']==101) && ($user['align'] != 2.2) && ($user['align'] != 2.1))
|
||||
{
|
||||
if ($zay->user_status($user['id']) == 0)
|
||||
if (($user['room'] == 101) && ($user['align'] != 2.2) && ($user['align'] != 2.1)) {
|
||||
echo "<BR><CENTER><B>Свет и Тьма не снизойдут к вашей просьбе начать новый бой</b></CENTER>";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo '<INPUT TYPE=hidden name=level value=group><INPUT TYPE=submit value="Подать новую заявку" name=open1>';
|
||||
}
|
||||
if( $zay->ustatus($user['id'])!=0) {
|
||||
if ($zay->user_status($user['id']) != 0) {
|
||||
$z = $zay->getlist(4, null, $user['zayavka']);
|
||||
if ($z[$user['zayavka']]['level'] == 4) {
|
||||
echo "<B>Ожидаем начала группового боя...</B><BR>Бой начнется через: " . round(($z[$user['zayavka']]['start'] - time()) / 60, 1) . " мин.";
|
||||
@ -1069,21 +1187,16 @@ if ($_REQUEST['level'] == 'group') {
|
||||
echo '<BR><INPUT TYPE=submit value="Принять участие" NAME=goconfirm><BR>';
|
||||
|
||||
if ($z = $zay->getlist(4, $_SESSION['view']))
|
||||
foreach ($z as $k=>$v)
|
||||
{
|
||||
foreach ($z as $k => $v) {
|
||||
$ok = 0;
|
||||
if ($user['room'] == 101)
|
||||
{
|
||||
if ($user['room'] == 101) {
|
||||
$vs_test = mysql_fetch_array(mysql_query("SELECT * FROM zayavka where id='{$z[$k]['id']}' limit 1 "));
|
||||
if ($vs_test['versus'] == 1) $ok = 1;
|
||||
else $ok = 0;
|
||||
}
|
||||
else $ok=0;
|
||||
} else $ok = 0;
|
||||
|
||||
if(($ok==0 && $user['room']!=101)||($ok==1 && $user['room']==101))
|
||||
{
|
||||
if ((($z[$k]['start']-time()) < 0) || (($z[$k]['t1c'] == count($z[$k]['team1'])) && ($z[$k]['t2c'] == count($z[$k]['team2']))))
|
||||
{
|
||||
if (($ok == 0 && $user['room'] != 101) || ($ok == 1 && $user['room'] == 101)) {
|
||||
if ((($z[$k]['start'] - time()) < 0) || (($z[$k]['t1c'] == count($z[$k]['team1'])) && ($z[$k]['t2c'] == count($z[$k]['team2'])))) {
|
||||
$zay->battlestart("CHAOS", $k, 4);
|
||||
}
|
||||
echo $zay->showgroup($v);
|
||||
@ -1094,7 +1207,9 @@ if ($_REQUEST['level'] == 'group') {
|
||||
|
||||
|
||||
if ($_REQUEST['level'] == 'haos') {
|
||||
if($user['level']<2) {die("<BR><BR><BR><CENTER><B>Хаотичные бои доступны с 2 уровня.</b></CENTER>");}
|
||||
if ($user['level'] < 2) {
|
||||
die("<BR><BR><BR><CENTER><B>Хаотичные бои доступны с 2 уровня.</b></CENTER>");
|
||||
}
|
||||
|
||||
if ($_POST['open'] && !$user['zayavka']) {
|
||||
switch ($_POST['levellogin1']) {
|
||||
@ -1114,16 +1229,20 @@ if ($_REQUEST['level'] == 'haos') {
|
||||
//$_POST['k'] = 3;
|
||||
|
||||
$blood = 0;
|
||||
if($_POST['travma']) {$blood = 1;}
|
||||
if ($_POST['travma']) {
|
||||
$blood = 1;
|
||||
}
|
||||
echo $zay->addzayavka($_POST['startime2'] / 60, $_POST['timeout'], 99, 99, $_POST['k'], $min1, $min1, $max1, $max1, $_POST['cmt'], $user['id'], 5, 0, $blood);
|
||||
}
|
||||
if($_POST['confirm2']) {echo "<span class='redalert'>".$zay->addteam (1,$user['id'], $_REQUEST['gocombat'], 5)."</span>";}
|
||||
if ($_POST['confirm2']) {
|
||||
echo "<span class='redalert'>" . $zay->addteam(1, $user['id'], $_REQUEST['gocombat'], 5) . "</span>";
|
||||
}
|
||||
|
||||
echo '<table cellspacing=0 cellpadding=0><tr><td>';
|
||||
if( $zay->ustatus($user['id'])==0 ) {
|
||||
if ($zay->user_status($user['id']) == 0) {
|
||||
echo 'Хаотичный бой - разновидность группового, где группы формируются автоматически. Бой не начнется, если собралось меньше 4-х человек. <DIV id="dv2" style="display:"><A href="#" onclick="dv1.style.display=\'\'; dv2.style.display=\'none\'; return false">Подать заявку на хаотичный бой</A></DIV><DIV id="dv1" style="display: none"><FIELDSET><LEGEND><B>Подать заявку на хаотичный бой</B> </LEGEND>Начало боя через <SELECT NAME=startime2><option value=180>3 минуты</option><option value=300 selected>5 минут</option><option value=600>10 минут</option><option value=900>15 минут</option><option value=1800>30 минут</option><option value=2700>45 минут</option><option value=3600>1 час</option></SELECT> Таймаут <SELECT NAME=timeout><OPTION value=3 SELECTED>3 мин.<OPTION value=5>5 мин.<OPTION value=10>10 мин.</SELECT><BR>Уровни бойцов <SELECT NAME=levellogin1><option value=0>любой<option value=3>только моего уровня<option value=6 selected>мой уровень +/- 1</SELECT><BR><BR>Тип боя <SELECT NAME=k><OPTION value=3>с оружием<OPTION value=5>кулачный</SELECT><BR><INPUT TYPE=checkbox NAME=travma> Бой без правил (<font class=dsc>проигравшая сторона получает инвалидность</font>)<BR><INPUT TYPE=submit name=open value="Подать заявку"> <BR>Комментарий к бою <INPUT TYPE=text NAME=cmt maxlength=40 size=40></FIELDSET><BR></DIV>';
|
||||
}
|
||||
if( $zay->ustatus($user['id'])!=0) {
|
||||
if ($zay->user_status($user['id']) != 0) {
|
||||
$z = $zay->getlist(5, null, $user['zayavka']);
|
||||
if ($z[$user['zayavka']]['level'] == 5)
|
||||
echo "<B>Ожидаем начала группового боя...</B><BR>Бой начнется через: " . round(($z[$user['zayavka']]['start'] - time()) / 60, 1) . " мин.";
|
||||
@ -1148,13 +1267,17 @@ if($_REQUEST['tklogs'] != null) {
|
||||
echo "<span class=date>{$row['date']}</span>";
|
||||
$z = explode(";", $row['t1']);
|
||||
foreach ($z as $k => $v) {
|
||||
if($k > 0) { echo ","; }
|
||||
if ($k > 0) {
|
||||
echo ",";
|
||||
}
|
||||
nick::id($v)->full();
|
||||
}
|
||||
echo " против ";
|
||||
$z = explode(";", $row['t2']);
|
||||
foreach ($z as $k => $v) {
|
||||
if($k > 0) { echo ","; }
|
||||
if ($k > 0) {
|
||||
echo ",";
|
||||
}
|
||||
nick::id($v)->full();
|
||||
}
|
||||
echo "<img src='i/fighttype{$row['type']}.gif'> <a href='logs.php?log={$row['id']}' target=_blank>»»</a><br />";
|
||||
@ -1210,7 +1333,7 @@ if($_REQUEST['logs'] != null) {
|
||||
echo '<HR><BR>';
|
||||
}
|
||||
|
||||
mysql_query("UNLOCK TABLES");
|
||||
db::c()->query('UNLOCK TABLES');
|
||||
|
||||
?>
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user