Фиксы запросов в базу

This commit is contained in:
Igor Barkov (iwork) 2020-02-17 17:36:41 +02:00
parent 5842b39b24
commit 6a119b8e4d

View File

@ -39,6 +39,7 @@ $fbattle = new fbattle($user['battle']);
<?}?>
const timerID = setTimeout("refreshPeriodic()", 20000);
}
timerID = setTimeout("refreshPeriodic()", 20000);
</SCRIPT>
<script>
@ -170,8 +171,8 @@ $fbattle = new fbattle($user['battle']);
</table>
<center>
<? if ($user['level'] > 3) {
if (@$_GET['use']) {
$dressed = mysql_fetch_row(mysql_query("SELECT `id` FROM `inventory` WHERE `id` = '" . (int)$_GET['use'] . "' AND `dressed` = 1"));
if ($_GET['use']) {
$dressed = db::c()->query('SELECT `id` FROM `inventory` WHERE `id` = ?i AND `dressed` = 1', $_GET['use'])->fetch_row();
if ((int)$dressed[0] > 0) {
$my_class = $fbattle->my_class;
ob_start();
@ -334,7 +335,7 @@ $fbattle = new fbattle($user['battle']);
$ll_r = mysql_fetch_array(mysql_query("SELECT `id` FROM `battle` WHERE (`t1` LIKE '%{$user['id']}%' || `t2` LIKE '%{$user['id']}%') AND `win` = '3' LIMIT 1"));
$ll = $ll_r['id'];
}
$data = @mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id` = {$ll} LIMIT 1"));
$data = db::c()->query('SELECT * FROM `battle` WHERE `id` = ?i', $ll)->fetch_assoc();
$damage = unserialize($data['damage']);
$exp = unserialize($data['exp']);
if (empty($damage[$user['id']])) {
@ -356,7 +357,6 @@ $fbattle = new fbattle($user['battle']);
} else {
?>
</center>
<? }
if ($fbattle->battle) {
@ -487,7 +487,7 @@ $fbattle = new fbattle($user['battle']);
echo showinf_pers($fbattle->enemy, 1);
} else {
if ($fbattle->battle_data['type'] == 4 || $fbattle->battle_data['type'] == 5) {
$a = array(6, 16);
$a = [6, 16];
echo "<img src='i/im/" . $a[mt_rand(0, 1)] . ".gif' />";
} elseif ($fbattle->return > 1) {
echo "<img src='i/im/" . mt_rand(1, 34) . ".jpg' />";
@ -507,8 +507,8 @@ $fbattle = new fbattle($user['battle']);
if ($k > _BOTSEPARATOR_) {
foreach ($v as $k2 => $v2) {
if ($k2 < _BOTSEPARATOR_) continue;
$hp_1 = mysql_fetch_array(mysql_query('SELECT `hp` FROM `bots` WHERE `id` = "' . $k . '" LIMIT 1'));
$hp_2 = mysql_fetch_array(mysql_query('SELECT `hp` FROM `bots` WHERE `id` = "' . $k2 . '" LIMIT 1'));
$hp_1 = db::c()->query('SELECT `hp` FROM `bots` WHERE `id` = ?i', $k)->fetch_assoc();
$hp_2 = db::c()->query('SELECT `hp` FROM `bots` WHERE `id` = ?i', $k2)->fetch_assoc();
if ($fbattle->battle[$k][$k2][0] && $fbattle->battle[$k2][$k][0] && $hp_1['hp'] > 0 && $hp_2['hp'] > 0 && time() - $fbattle->battle[$k][$k2][2] > 1 && time() - $fbattle->battle[$k2][$k][2] > 1) {
$at_1 = $fbattle->battle[$k][$k2][0];
$def_1 = $fbattle->battle[$k][$k2][1];
@ -516,8 +516,8 @@ $fbattle = new fbattle($user['battle']);
$def_2 = $fbattle->battle[$k2][$k][1];
$fbattle->makechange($k, $k2, $at_1, $at_2, $def_1, $def_2);
$fbattle->write_log();
$fbattle->battle[$k][$k2] = array(0, 0, time());
$fbattle->battle[$k2][$k] = array(0, 0, time());
$fbattle->battle[$k][$k2] = [0, 0, time()];
$fbattle->battle[$k2][$k] = [0, 0, time()];
$fbattle->needupdate = 1;
}
}
@ -544,4 +544,6 @@ $fbattle = new fbattle($user['battle']);
</body>
</html>
<?php mysql_query("UNLOCK TABLES"); ?>
<?php
db::c()->query('UNLOCK TABLES');
?>