diff --git a/functions.php b/functions.php index 580f03a..c2495f4 100644 --- a/functions.php +++ b/functions.php @@ -1676,11 +1676,11 @@ function showitem($row, $type = null, $returned = false, $infOnly = false) if ($type != 10) { $returnHTML .= '
ID: ' . $row['id'] . '
'; if ($row["koll"] > 1) $returnHTML .= " "; - $returnHTML .= ""; + $returnHTML .= ""; } } - $returnHTML .= ""; + $returnHTML .= ""; // Первая строчка $returnHTML .= $row['name']; @@ -1941,15 +1941,6 @@ function dropitemid($slot, $id) case 23: $slot1 = 'plaw'; break; - case 24: - $slot1 = 'rune_1'; - break; - case 25: - $slot1 = 'rune_2'; - break; - case 26: - $slot1 = 'rune_3'; - break; default: $slot1 = ''; break; @@ -2039,15 +2030,6 @@ function dropitem($slot) case 23: $slot1 = 'plaw'; break; - case 24: - $slot1 = 'rune_1'; - break; - case 25: - $slot1 = 'rune_2'; - break; - case 26: - $slot1 = 'rune_3'; - break; default: $slot1 = ''; break; @@ -2265,15 +2247,6 @@ function destructitem($id) case 23: $slot1 = 'plaw'; break; - case 24: - $slot1 = 'rune_1'; - break; - case 25: - $slot1 = 'rune_2'; - break; - case 26: - $slot1 = 'rune_3'; - break; } if ($dress['type'] == 5) { if ($user['r1'] == $dress['id']) { @@ -2283,14 +2256,6 @@ function destructitem($id) } elseif ($user['r3'] == $dress['id']) { $slot1 = 'r3'; } - } elseif ($dress['type'] == 24) { - if ($user['rune_1'] == $dress['id']) { - $slot1 = 'rune_1'; - } elseif ($user['rune_2'] == $dress['id']) { - $slot1 = 'rune_2'; - } elseif ($user['rune_3'] == $dress['id']) { - $slot1 = 'rune_3'; - } } elseif ($dress['type'] == 12) { if ($user['m1'] == $dress['id']) { $slot1 = 'm1'; diff --git a/inf.php b/inf.php index e0b6797..928780e 100644 --- a/inf.php +++ b/inf.php @@ -77,32 +77,27 @@ if (!empty($user['realname'])) echo "Имя: " . $user['realname'] . "
"; 1.2)) OR (!empty($own['admin']))) $okdop = 1; +if ((($own['align'] == 1) AND (!$user['admin'])) OR (!empty($own['admin']))) $showModeratorInfo = true; -if ($okld == 1) { - echo "

Личное дело

"; +if ($showModeratorInfo == 1) { $ld = db::c()->query('SELECT * FROM `lichka` WHERE `pers` = ?i ORDER BY `id` ASC', $user['id']); + $iplog = db::c()->query('SELECT idperslater FROM delo_multi WHERE idpersnow = ?i GROUP BY idperslater ASC', $user['id']); + + echo "

Личное дело

"; while ($row_ld = $ld->fetch_assoc()) { $dat = date("d.m.Y H:i", $row_ld['date']); echo "$dat {$row_ld['text']}
"; } -} -if ($okdop == 1) { - $iplog = db::c()->query('SELECT idperslater FROM delo_multi WHERE idpersnow = ?i GROUP BY idperslater ASC', $user['id']); if ($iplog->getNumRows()) { echo "

Возможные мульты

"; while ($row_iplog = $iplog->fetch_assoc()) echo nick::id($row_iplog['idperslater'])->full() . " "; } echo "

Дополнительные сведения

"; - if (!empty($user['id'])) echo "ID: " . $user['id'] . "
"; if (!empty($user['email'])) echo "E-mail: " . $user['email'] . "
"; if (!empty($user['borndate'])) echo "День рождения: " . $user['borndate'] . "
"; diff --git a/main.php b/main.php index 6e8af9d..a4e9ca4 100644 --- a/main.php +++ b/main.php @@ -2,11 +2,9 @@ ob_start("ob_gzhandler"); session_start(); $errkom = ''; -if (!isset($_SESSION['uid'])) { - header("Location: index.php"); -} -include("config.php"); -include("functions.php"); +if (!isset($_SESSION['uid'])) header("Location: index.php"); + +require_once 'functions.php'; $tmaz = time(); db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `id` = ?i', time(), $user['id']); if ($user['battle'] != 0) { @@ -14,34 +12,30 @@ if ($user['battle'] != 0) { die(); } -/// fixme заводить переменную равную нулю и целую функцию, чтобы прибавить к нулю значение? исправить! function sum_mf($u) { - $t = 0; - $r = mysql_fetch_array(mysql_query('SELECT SUM(`add_proc_mf`) AS `mf` FROM `inventory` WHERE `owner` = "' . $u . '" AND `dressed` = "1" AND `add_proc_mf` > 0')); - $r = $t + $r['mf']; - return $r; + $sum = db::c()->query('SELECT SUM(`add_proc_mf`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_mf` > 0 AND `owner` = ?i', $u); + if ($sum->fetch_assoc() > 0) return $sum; + else return 0; } function sum_dmg($u) { - $t = 0; - $r = mysql_fetch_array(mysql_query('SELECT SUM(`add_proc_uron`) AS `mf` FROM `inventory` WHERE `owner` = "' . $u . '" AND `dressed` = "1" AND `add_proc_uron` > 0')); - $r = $t + $r['mf']; - return $r; + $sum = db::c()->query('SELECT SUM(`add_proc_uron`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_uron` > 0 AND `owner` = ?i', $u); + if ($sum->fetch_assoc() > 0) return $sum; + else return 0; } function sum_bron($u) { - $t = 0; - $r = mysql_fetch_array(mysql_query('SELECT SUM(`add_proc_bron`) AS `mf` FROM `inventory` WHERE `owner` = "' . $u . '" AND `dressed` = "1" AND `add_proc_bron` > 0')); - $r = $t + $r['mf']; - return $r; + $sum = db::c()->query('SELECT SUM(`add_proc_bron`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_bron` > 0 AND `owner` = ?i', $u); + if ($sum->fetch_assoc() > 0) return $sum; + else return 0; } function bron_ads($a1, $a2, $a3, $a4, $col) { - return array('a1' => round(($a1 / 100) * $col), 'a2' => round(($a2 / 100) * $col), 'a3' => round(($a3 / 100) * $col), 'a4' => round(($a4 / 100) * $col)); + return ['a1' => round(($a1 / 100) * $col), 'a2' => round(($a2 / 100) * $col), 'a3' => round(($a3 / 100) * $col), 'a4' => round(($a4 / 100) * $col)]; } @@ -156,7 +150,7 @@ function countmf() $bmfbron = 0; } - $mf = array(); + $mf = []; $user_dress = db::c()->query('SELECT SUM(`minu`), SUM(`maxu`), SUM(`mfkrit`), SUM(`mfakrit`), SUM(`mfuvorot`), SUM(`mfauvorot`), SUM(`bron1`), SUM(`bron2`), SUM(`bron3`), SUM(`bron4`) FROM `inventory` WHERE `dressed` = 1 AND `owner` = ?i', $user['id'])->fetch_row(); $user_dress[6] = $bmfbron; @@ -175,7 +169,7 @@ function countmf() $myuvorot = $user_dress[4] + ($user['lovk'] * 5); $myauvorot = $user_dress[5] + ($user['lovk'] * 4); - $mf['me'] = array('udar' => (floor($user['sila'] / 3) + 1 + $user_dress[0]), 'maxudar' => (floor($user['sila'] / 3) + 4 + $user_dress[1])); + $mf['me'] = ['udar' => (floor($user['sila'] / 3) + 1 + $user_dress[0]), 'maxudar' => (floor($user['sila'] / 3) + 4 + $user_dress[1])]; if ($mf['me']['udar'] < 0) { $mf['me']['udar'] = 0; @@ -197,7 +191,7 @@ function countmf() break; } - return array('minu' => $mf['me']['udar'] + $bmfud + $weap_b, 'maxu' => $mf['me']['maxudar'] + $bmfud + $weap_b, 'fkrit' => round($mykrit, 0), 'fakrit' => round($myakrit, 0), 'fuvorot' => round($myuvorot, 0), 'fauvorot' => round($myauvorot, 0), 'bron1' => $user_dress[6], 'bron2' => $user_dress[7], 'bron3' => $user_dress[8], 'bron4' => $user_dress[9]); + return ['minu' => $mf['me']['udar'] + $bmfud + $weap_b, 'maxu' => $mf['me']['maxudar'] + $bmfud + $weap_b, 'fkrit' => round($mykrit, 0), 'fakrit' => round($myakrit, 0), 'fuvorot' => round($myuvorot, 0), 'fauvorot' => round($myauvorot, 0), 'bron1' => $user_dress[6], 'bron2' => $user_dress[7], 'bron3' => $user_dress[8], 'bron4' => $user_dress[9]]; } // одеть предмет @@ -248,77 +242,32 @@ function dressitem($id) case 23: $slot1 = 'plaw'; break; - case 24: - $slot1 = 'rune_1'; - break; - case 25: - $slot1 = 'rune_2'; - break; - case 26: - $slot1 = 'rune_3'; - break; } if ($item['type'] == 5) { - if (!$user['r1']) { - $slot1 = 'r1'; - } elseif (!$user['r2']) { - $slot1 = 'r2'; - } elseif (!$user['r3']) { - $slot1 = 'r3'; - } else { + if (!$user['r1']) $slot1 = 'r1'; + elseif (!$user['r2']) $slot1 = 'r2'; + elseif (!$user['r3']) $slot1 = 'r3'; + else { $slot1 = 'r1'; dropitem(5); } - } elseif ($item['type'] == 24) { - if (!$user['rune_1']) { - $slot1 = 'rune_1'; - } elseif (!$user['rune_2']) { - $slot1 = 'rune_2'; - } elseif (!$user['rune_3']) { - $slot1 = 'rune_3'; - } else { - $slot1 = 'rune_1'; - dropitem(24); - } } elseif ($item['type'] == 12) { - if (!$user['m1']) { - $slot1 = 'm1'; - } elseif (!$user['m2']) { - $slot1 = 'm2'; - } elseif (!$user['m3']) { - $slot1 = 'm3'; - } elseif (!$user['m4']) { - $slot1 = 'm4'; - } elseif (!$user['m5']) { - $slot1 = 'm5'; - } elseif (!$user['m6']) { - $slot1 = 'm6'; - } elseif (!$user['m7']) { - $slot1 = 'm7'; - } elseif (!$user['m8']) { - $slot1 = 'm8'; - } elseif (!$user['m9']) { - $slot1 = 'm9'; - } elseif (!$user['m10']) { - $slot1 = 'm10'; - } else { + if (!$user['m1']) $slot1 = 'm1'; + elseif (!$user['m2']) $slot1 = 'm2'; + elseif (!$user['m3']) $slot1 = 'm3'; + elseif (!$user['m4']) $slot1 = 'm4'; + elseif (!$user['m5']) $slot1 = 'm5'; + elseif (!$user['m6']) $slot1 = 'm6'; + elseif (!$user['m7']) $slot1 = 'm7'; + elseif (!$user['m8']) $slot1 = 'm8'; + elseif (!$user['m9']) $slot1 = 'm9'; + elseif (!$user['m10']) $slot1 = 'm10'; + else { $slot1 = 'm1'; dropitem(12); } - } else { - dropitem($item['type']); - } - $al = '(1 = 1)'; - if ($item['nalign'] > 0) { - if ($item['nalign'] == 1.1) { - if (($user['align'] == 6 || ($user['align'] > 1 && $user['align'] < 2))) { - $al = '(1 = 1)'; - } else { - $al = '(1 = 2)'; - } - } - } + } else dropitem($item['type']); if (!($item['type'] == 12 && $user['level'] < 4)) { if (db::c()->query('UPDATE `users` AS `u`, `inventory` AS `i` SET `u`.?f = ?i, `i`.`dressed` = 1, `u`.`sila` = `u`.`sila` + `i`.`gsila`, `u`.`lovk` = `u`.`lovk` + `i`.`glovk`, `u`.`inta` = `u`.`inta` + `i`.`ginta`, `u`.`intel` = `u`.`intel` + `i`.`gintel`, `u`.`maxhp` = `u`.`maxhp` + `i`.`ghp`, `u`.`noj` = `u`.`noj` + `i`.`gnoj`, `u`.`topor` = `u`.`topor` + `i`.`gtopor`, `u`.`dubina` = `u`.`dubina` + `i`.`gdubina`, `u`.`mec` = `u`.`mec` + `i`.`gmech`, `u`.`mfire` = `u`.`mfire` + `i`.`gfire`, `u`.`mwater` = `u`.`mwater` + `i`.`gwater`, `u`.`mair` = `u`.`mair` + `i`.`gair`, `u`.`mearth` = `u`.`mearth` + `i`.`gearth`, `u`.`mlight` = `u`.`mlight` + `i`.`glight`, `u`.`mgray` = `u`.`mgray` + `i`.`ggray`, `u`.`mdark` = `u`.`mdark` + `i`.`gdark`, `u`.`ubron1` = `u`.`ubron1` + `i`.`bron1`, `u`.`ubron2` = `u`.`ubron2` + `i`.`bron2`, `u`.`ubron3` = `u`.`ubron3` + `i`.`bron3`, `u`.`ubron4` = `u`.`ubron4` + `i`.`bron4`, `u`.`fkrit` = `u`.`fkrit` + `i`.`mfkrit`, `u`.`fakrit` = `u`.`fakrit` + `i`.`mfakrit`, `u`.`fuvorot` = `u`.`fuvorot` + `i`.`mfuvorot`, `u`.`fauvorot` = `u`.`fauvorot` + `i`.`mfauvorot`, `u`.`uminu` = `u`.`uminu` + `i`.`minu`, `u`.`umaxu` = `u`.`umaxu` + `i`.`maxu` WHERE `i`.`needident` = 0 AND `i`.`id` = ?i AND `i`.`dressed` = 0 AND `i`.owner = ?i AND (20 + `u`.`sila`) >= `i`.`nsila` AND (20 + `u`.`lovk`) >= `i`.`nlovk` AND (20 + `u`.`inta`) >= `i`.`ninta` AND `u`.`vinos` >= `i`.`nvinos` AND (20 + `u`.`intel`) >= `i`.`nintel` AND `u`.`mudra` >= `i`.`nmudra` AND `u`.`level` >= `i`.`nlevel` AND (("?s" OR (?i = `i`.`nalign`)) OR (`i`.`nalign` = 0)) AND `u`.`noj` >= `i`.`nnoj` AND `u`.`topor` >= `i`.`ntopor` AND `u`.`dubina` >= `i`.`ndubina` AND `u`.`mec` >= `i`.`nmech` AND `u`.`mfire` >= `i`.`nfire` AND `u`.`mwater` >= `i`.`nwater` AND `u`.`mair` >= `i`.`nair` AND `u`.`mearth` >= `i`.`nearth` AND `u`.`mlight` >= `i`.`nlight` AND `u`.`mgray` >= `i`.`ngray` AND `u`.`mdark` >= `i`.`ndark` AND `i`.`setsale` = 0 AND `u`.`id` = ?i', $slot1, $id, $id, $user['id'], $al, $user['align'], $user['id'])) @@ -329,6 +278,7 @@ function dressitem($id) /** * Отображение персонажа в main.php + * * @param $id */ function showpersinv($id) @@ -348,18 +298,9 @@ function showpersinv($id) } ?>
- .gif"> - - [] - target=_blank>Инф. о <?= $user['login'] ?> - + + - - - - 3) { ?> @@ -1598,12 +1539,12 @@ if (input::get('edit')) { $q = db::c()->query('SELECT `id` FROM `komplekt` WHERE `name` = "?s" AND `owner` = ?i', input::get('savecomplect'), $_SESSION['uid'])->getNumRows(); if (empty($q)) { $items = []; - $q2 = db::c()->query('SELECT `id` FROM `inventory` WHERE `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i', + $q2 = db::c()->query('SELECT `id` FROM `inventory` WHERE `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i', $user['sergi'], $user['kulon'], $user['perchi'], $user['weap'], $user['bron'], $user['rybax'], $user['r1'], $user['r2'], $user['r3'], $user['helm'], $user['shit'], $user['m1'], $user['m2'], $user['m3'], $user['m4'], $user['m5'], $user['m6'], $user['m7'], $user['m8'], $user['m9'], $user['m10'], - $user['boots'], $user['plaw'], $user['rune_1'], $user['rune_2'], $user['rune_3']); + $user['boots'], $user['plaw']); while ($res = $q2->fetch_assoc()) $items[] = $res['id']; $t_items = implode(";", $items); db::c()->query('INSERT INTO `komplekt` (`name`, `owner`, `items`) VALUES ("?s",?i,"?s")', input::get('savecomplect'), $_SESSION['uid'], $t_items); @@ -1612,7 +1553,7 @@ if (input::get('edit')) { } else err('Ошибка: запрещённые символы!'); } - if (!in_array(input::get('mZeAjax'), array('mZeInventory', 'mZeFilter'))): ?> + if (!in_array(input::get('mZeAjax'), ['mZeInventory', 'mZeFilter'])): ?> @@ -1813,7 +1754,7 @@ if (input::get('edit')) { $add_bron = sum_bron($user['id']); $var_brons = bron_ads($mf['bron1'], $mf['bron2'], $mf['bron3'], $mf['bron4'], $add_bron); } else { - $var_brons = array('a1' => 0, 'a2' => 0, 'a3' => 0, 'a4' => 0); + $var_brons = ['a1' => 0, 'a2' => 0, 'a3' => 0, 'a4' => 0]; } ?> @@ -2137,7 +2078,7 @@ if (input::get('edit')) {
- +
- -
- +