Отказ от алиаса die в пользу exit, более явная проверка на наличие сессии. Некоторые проверки входа теперь проверяют объекты, а не массив.

This commit is contained in:
Igor Barkov (iwork)
2020-09-30 15:01:33 +03:00
parent 02dc4582dc
commit a08ce17a40
179 changed files with 883 additions and 582 deletions

View File

@@ -12,14 +12,14 @@ class Tournament
global $user;
$chek = mysql_fetch_row(mysql_query("select id from turnament where id=" . $id . " and old=0"));
if ($chek[0] == '') {
die("Жаль, очень жаль....");
exit("Жаль, очень жаль....");
}
if (mysql_query("insert into turnamuser (idturnam,iduser,level) values(" . $id . "," . $user['id'] . "," . $user['level'] . ")")) {
mysql_query("update turnament set kolvo=kolvo+1 where id=" . $id);
echo "Регистрация пройдена!";
} else {
die("Вы уже зарегистрированы.");
exit("Вы уже зарегистрированы.");
}
}
@@ -158,7 +158,7 @@ class Tournament
mysql_query("UPDATE `users` SET `battle` = {$id} WHERE `id` = " . $user1 . " OR `id` = " . $user2);
// создаем лог
$rr = "<b>" . Nick::id($user['id'])->full(1) . "</b> и <b>" . Nick::id($jert['id'])->full(1) . "</b>";
addch("<a href=logs.php?log=" . $id . " target=_blank>Бой</a> между <B><b>" . Nick::id($user['id'])->short() . "</b> и <b>" . Nick::id($jert['id'])->short() . "</b> начался. ", $user['room']);
addch("<a href=logs.php?log=" . $id . " target=_blank>Бой</a> между <B><b>" . Nick::id($user['id'])->short() . "</b> и <b>" . Nick::id($jert['id'])->short() . "</b> начался. ", $user->room);
addlog($id, "Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " решили выяснить кто из них сильнее. <i>(турнир)</i><BR>");
return $id;
}

View File

@@ -237,7 +237,7 @@ class fbattle
// ставим статус битвы на "нет битвы"
$this->status = 0;
//header ("Location:main.php");
//die();
//exit;
//$this->return = 5;
//return $this->return;
}
@@ -414,7 +414,7 @@ class fbattle
// обновить битку
$this->update_battle();
header("Location: " . $_SERVER['PHP_SELF'] . "");
die();
exit;
}
} else {
return false;
@@ -1701,7 +1701,7 @@ class fbattle
}
if (in_array($user['room'], Config::$caverooms)) {
if (in_array($user->room, Config::$caverooms)) {
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir` FROM `caveparties` WHERE `user` = '" . $this->user['id'] . "' LIMIT 1"));
if ($location['dir'] == 0) {
@@ -1790,13 +1790,13 @@ class fbattle
// выносим хп-ку и выходим из боя
mysql_query('UPDATE `battle` SET `t1hist` = \'' . implode(", ", $nks1hist) . '\', `t2hist` = \'' . implode(", ", $nks2hist) . '\' WHERE `id` = ' . $this->battle_data['id'] . ' ;');
addch("<a href=logs.php?log=" . $this->battle_data['id'] . " target=_blank>Поединок</a> между <B>" . $rr . "</B> закончен. ", $user['room']);
addch("<a href=logs.php?log=" . $this->battle_data['id'] . " target=_blank>Поединок</a> между <B>" . $rr . "</B> закончен. ", $user->room);
mysql_query('UPDATE `battle` SET `exp` = \'' . serialize($this->exp) . '\' WHERE `id` = ' . $this->battle_data['id'] . ' ;');
mysql_query("DELETE FROM `bots` WHERE `battle` = {$this->user['battle']};");
mysql_query("UPDATE users SET `battle` =0, `fullhptime` = " . time() . " WHERE `battle` = {$this->user['battle']}");
echo mysql_error();
unset($this->battle);
//header("Location: fbattle.php"); die();
//header("Location: fbattle.php"); exit;
return true;
// =================================================================
}

View File

@@ -1,8 +1,8 @@
<?php
if (in_array($user['room'], Config::$caverooms)) {
if (in_array($user->room, Config::$caverooms)) {
$cavedata = Config::$cavedata ?? [];
$floor = mysql_fetch_row(mysql_query("SELECT `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
if (!isset($cavedata[$user['room']]['x' . $floor])) {
if (!isset($cavedata[$user->room]['x' . $floor])) {
$floor = 1;
}
}
@@ -11,12 +11,12 @@ $lomka1 = $lomka;
foreach ($lomka1 as $k => $v) {
if ($v < _BOTSEPARATOR_) {
if (in_array($user['room'], Config::$caverooms)) {
mysql_query("UPDATE `caveparties` SET `floor` = $floor, `x` = '" . $cavedata[$user['room']]['x' . $floor] . "', `y` = '" . $cavedata[$user['room']]['y' . $floor] . "', `dir` = '" . $cavedata[$user['room']]['dir' . $floor] . "', `loses` = (`loses`+1) WHERE `user` = '$v' LIMIT 1");
if (in_array($user->room, Config::$caverooms)) {
mysql_query("UPDATE `caveparties` SET `floor` = $floor, `x` = '" . $cavedata[$user->room]['x' . $floor] . "', `y` = '" . $cavedata[$user->room]['y' . $floor] . "', `dir` = '" . $cavedata[$user->room]['dir' . $floor] . "', `loses` = (`loses`+1) WHERE `user` = '$v' LIMIT 1");
}
if ($user['laba'] > 0) {
mysql_query('UPDATE `users` SET `x` = `xf`, `y` = `yr` WHERE `id` = "' . $v . '" LIMIT 1');
die('Suka');
exit('Suka');
}
}
}

View File

@@ -21,7 +21,7 @@ function cavesys($text)
}
}
if (in_array($user['room'], Config::$caverooms)) {
if (in_array($user->room, Config::$caverooms)) {
include("CaveItems.php");
mysql_query('LOCK TABLES `cavebots` WRITE, `caveitems` WRITE, `shop` WRITE, `caveparties` WRITE');
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir`, `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
@@ -55,7 +55,7 @@ if (in_array($user['room'], Config::$caverooms)) {
$bot = $rec['bot'];
$cnt = $rec['cnt'];
if (@$caveitems[$bot]) {
if ($user['room'] == 621) {
if ($user->room == 621) {
$i = mt_rand(0, (count($caveitems[$bot]) - 1));
$item = $caveitems[$bot][$i];
if (getchance($item['chance'])) {

View File

@@ -569,7 +569,7 @@ TASK;
mysql_query('UPDATE `users` SET `money` = "' . $user['money'] . '", `exp` = "' . $user['exp'] . '", `doblest` = "' . $user['doblest'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1');
$this->error = 'Вы успешно сдали задание!';
$text = '<font style="color: Red;">Внимание!</font> За успешно выполненное задание Вы получили : ' . $c;
$this->msg($text, '{[]}' . $user['login'] . '{[]}', $user['room']);
$this->msg($text, '{[]}' . $user['login'] . '{[]}', $user->room);
} else {
$this->error = 'Не все условия задания были выполнены ...';
}