Trying to access array offset on value of type null i

This commit is contained in:
Ivor Barhansky 2023-01-12 03:18:17 +02:00
parent a1aca77a35
commit 84c0847178

View File

@ -1,5 +1,6 @@
<?php <?php
use Core\Config;
use Core\Database; use Core\Database;
use Core\Db; use Core\Db;
@ -7,7 +8,7 @@ if (!defined('GAME_VERSION')) {
require_once '_incl_data/autoload.php'; require_once '_incl_data/autoload.php';
} }
Config::init();
Database::init(); Database::init();
if (isset($_COOKIE['login'])) { if (isset($_COOKIE['login'])) {
@ -98,7 +99,9 @@ $rt = [
/* Предмет */ /* Предмет */
$itm = Db::getRow('select * from items_main where id = ?', [$_GET['id']]); $itm = Db::getRow('select * from items_main where id = ?', [$_GET['id']]);
if (empty($itm)) {
$itm = [];
}
function timeOut($ttm) function timeOut($ttm)
{ {
@ -167,19 +170,12 @@ function lookStats($m)
return $ist; return $ist;
} }
if (!isset($itm['id'])) { if (empty($itm['id']) && !empty($_GET['id'])) {
$itd = mysql_fetch_array( $data = Db::getValue('select data from items_main_data where items_id = ?', [$_GET['id']]);
mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = ' . mysql_real_escape_string($_GET['id']))
);
if (!isset($itd['id'])) {
$itd = [];
} else {
$itd = lookStats($itd['data']);
}
} else { } else {
$itd = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = ' . $itm['id'])); $data = Db::getValue('select data from items_main_data where items_id = ?', [$itm['id']]);
$itd = lookStats($itd['data']) ?? '';
} }
$itd = !empty($data) ? lookStats($data) : [];
$items = [ $items = [
'tr' => ['lvl', 's1', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9', 's10', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'mg1', 'mg2', 'mg3', 'mg4', 'mg5', 'mg6', 'mg7', 'mall', 'm2all', 'aall'], 'tr' => ['lvl', 's1', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9', 's10', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'mg1', 'mg2', 'mg3', 'mg4', 'mg5', 'mg6', 'mg7', 'mall', 'm2all', 'aall'],