Убраны неиспользуемые параметры и переменные.

This commit is contained in:
lopar 2018-01-28 23:51:21 +02:00
parent 4617365148
commit 0e0e5ccd7d

View File

@ -5,7 +5,7 @@ define("HPADDICTIONEFFECT", 33);
$ip = filter_input(INPUT_SERVER,'REMOTE_ADDR', FILTER_VALIDATE_IP);
if (isset($_GET['goto']) and isset($_GET['tStamp']) and isset($_GET['vcode'])) {
if ($_GET['vcode'] == md5(sha1($_GET['goto'] . SECURECODE . $_GET['tStamp']))) {
if ($_GET['vcode'] == md5(sha1($_GET['goto'] . $_GET['tStamp']))) {
db::c()->query('UPDATE `users`,`online` SET `users`.`room` = ?i, `online`.`room` = ?i WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_GET['goto'], $_GET['goto'], $_SESSION['uid']);
$user['room'] = intval($_GET['goto']);
}
@ -66,7 +66,7 @@ if ($user['battle'] == 0 && $user['hp'] < $user['maxhp']) {
}
if (!isset($banks['id'])) {
$banks = db::c()->query('SELECT `id`, `cr`, `ekr` FROM `bank` WHERE `id` = "?s" AND `owner` = "?S" LIMIT 1', $_COOKIE['inder'], $user['id'])->fetch_assoc();
$banks = db::c()->query('SELECT `id`, `cr`, `ekr` FROM `bank` WHERE `id` = "?s" AND `owner` = "?s" LIMIT 1', $_COOKIE['inder'], $user['id'])->fetch_assoc();
}
function auth_bank($id, $pass, $us)
@ -113,7 +113,7 @@ function getNum($v)
return $plid;
}
function banks($id)
function banks()
{
global $user, $banks;
// $bank = mysql_fetch_array(mysql_query('SELECT `id`, `cr`, `ekr` FROM `bank` WHERE `id` = "' . $banks['id'] . '" AND `owner` = "' . $user['id'] . '" LIMIT 1'));
@ -262,7 +262,6 @@ function close_dangling_tags($html)
function gotoroom($r, $redir = 1)
{
global $user;
mysql_query("UPDATE `users`, `online` SET `users`.`room` = '$r', `online`.`room` = '$r' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}'");
if ($redir) {
redirectbyroom($r);
@ -272,7 +271,6 @@ function gotoroom($r, $redir = 1)
function redirectbyroom($r)
{
global $canalenters;
$fn = str_replace("/", "", $_SERVER["PHP_SELF"]);
if (in_array($r, $canalenters)) {
header("location: enter_cave.php");
die();
@ -292,7 +290,7 @@ function redirectbyroom($r)
// }
//}
function battlewithbot($b, $name = '', $comment = '', $time = 3, $blood = 1, $group = 1, $battleid = 0, $otherbots = array(), $noredir = 0, $userid = 0, $type = 1)
function battlewithbot($b, $name = '', $time = 3, $blood = 1, $group = 1, $battleid = 0, $otherbots = array(), $noredir = 0, $userid = 0, $type = 1)
{
global $user;
if (!$userid) {
@ -387,12 +385,11 @@ function battlewithbot($b, $name = '', $comment = '', $time = 3, $blood = 1, $gr
$others .= "<span class=date>" . date("H:i") . "</span> <span class=B2>$botname</span> вмешался в поединок.<BR>";
$t2 .= ";$botid";
}
$sv = array(3, 4, 5);
mysql_query("INSERT INTO `battle` (`id`, `coment`, `teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`, `blood`, `date`) VALUES (NULL, '', '" . serialize($teams) . "', '" . $time . "', '$type', '0', '" . $user1['id'] . "', '" . $t2 . "', '" . time() . "', '" . time() . "', '$blood', '" . date("Y-m-d H:i") . "')");
$battleid = mysql_insert_id();
mysql_query("UPDATE `bots` SET `battle` = {$battleid} WHERE $cond");
mysql_query("UPDATE `users` SET `battle` = {$battleid} WHERE `id` = {$user1[id]} LIMIT 1");
mysql_query("UPDATE `users` SET `battle` = {$battleid} WHERE `id` = {$user1['id']} LIMIT 1");
if ($user1['invis'] == 1) {
$rr = "<b>невидимка</b> и <b>" . nick3($botid1) . "</b>";
@ -413,7 +410,6 @@ function battlewithbot($b, $name = '', $comment = '', $time = 3, $blood = 1, $gr
function backpacksize($u = 0)
{
global $user;
$l = 0;
if ($u) {
$l = $u['level'];
@ -500,7 +496,6 @@ function secs2hrs($s, $short = 0)
if ($sec || !$short) $retstr .= "$sec сек.";
return $retstr;
}
$ret = '';
$ret = floor($s / 3600);
$s = $s % 3600;
@ -677,7 +672,7 @@ function efs_go_storage($pl, $us)
}
function takeshopitem($item, $table = "shop", $present = '', $onlyonetrip = '', $destiny = 0, $fields = 0, $uid = 0, $koll = 1, $reason = '', $podzem = 0)
function takeshopitem($item, $table = "shop", $present = '', $onlyonetrip = '', $fields = 0, $uid = 0, $koll = 1, $podzem = 0)
{
global $user;
if (!$uid) {
@ -816,7 +811,6 @@ function bank_show()
function select_arenda($u, $type, $redirect = false)
{
$r = '';
$hostel = mysql_fetch_array(mysql_query('SELECT `id` FROM `hostel` WHERE `uid` = "' . $u['id'] . '" LIMIT 1'));
$price = array(1 => 8, 2 => 15, 3 => 25, 4 => 40);
if (!isset($u['id'])) {
@ -1101,7 +1095,6 @@ function lookStats($m)
$ist = array();
$di = explode('|', $m);
$i = 0;
$de = false;
while ($i < count($di)) {
$de = explode('=', $di[$i]);
if (isset($de[0], $de[1])) {
@ -1717,7 +1710,6 @@ function getslot($i, $user1 = 0)
function nick($user)
{
$r = '';
$id = $user['id'];
if ($user['align'] > 0) {
$al = $user['align'];
} else {
@ -1738,7 +1730,6 @@ function nick($user)
// nick
function nicks($user)
{
$id = $user['id'];
?>
<div id=HP><img src="i/align_<?
echo($user['align'] > 0 ? $user['align'] : "0"); ?>.gif"/><?php if ($user['klan'] != '') {
@ -2053,7 +2044,7 @@ function GiveDoblest($id, $dobl, $text = "Вы получили ")
}
// полоска НР
function setHP($hp, $maxhp, $battle)
function setHP($hp, $maxhp)
{
$rr = '';
if ($hp < $maxhp * 0.33) {
@ -2073,12 +2064,6 @@ function setHP($hp, $maxhp, $battle)
return $rr;
}
function setMP($mp, $maxmp, $battle)
{
$rr = '';
return $rr;
}
function echoscroll($slot)
{
global $user;
@ -2619,7 +2604,6 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false)
} else {
$data = mysql_fetch_array(mysql_query("SELECT * FROM `online` WHERE `date` >= " . (time() - 60) . " AND `id` = " . $user['id'] . " LIMIT 1"));
}
$dd = mysql_query("SELECT * FROM `effects` WHERE `owner` = " . $user['id'] . "");
$r .= '</td></tr></table></td></tr></table>';
$ru_1 = show_rune(1, $user['id']);
@ -2631,7 +2615,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false)
if (!$battle) {
if ($pas) {
$r .= '<tr><td align=middle colSpan=2><b><small>capitalcity.old-dark.ru</small></b></td></tr><tr><td colSpan=2><small>';
$r .= '<tr><td align=middle colSpan=2><b><small>'.GAMEDOMAIN.'</small></b></td></tr><tr><td colSpan=2><small>';
$online = mysql_fetch_array(mysql_query('SELECT `u`.*, `o`.`date`, `u`.*, `o`.`real_time` FROM `users` AS `u`, `online` AS `o` WHERE `u`.`id` = `o`.`id` AND `u`.`id` = "' . $user['id'] . '" LIMIT 1'));
if ($invis) {
$invis = mysql_fetch_row(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '$user1[id]' AND `type` = '1022' LIMIT 1"));
@ -2704,15 +2688,12 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false)
$r .= 'Поражений:&nbsp;<span>' . $user['lose'] . '</span></small><br />';
$r .= 'Ничьих:&nbsp;<span>' . $user['nich'] . '</span></small><br />';
}
$my_inf = mysql_fetch_assoc(mysql_query("SELECT `align`, `deal` FROM `users` WHERE `id` = '" . $_SESSION['uid'] . "' LIMIT 1"));
if ($user['klan'] && !$pas) {
$r .= "Клан: " . ClanImage($user['klan']) . "<br /></small>";
} elseif ($user['klan']) {
$clanname = mysql_fetch_array(mysql_query("SELECT `name`,`short` FROM `clans` WHERE `id` = '{$user['klan']}' LIMIT 1"));
$clanname = $clann['name'];
$clannamesh = $clann['short'];
$r .= "<a href='/encicl/index.php?section=99&page=clans1&clan=" . close_dangling_tags($clannamesh) . "' target='_blank'>" . close_dangling_tags($clanname) . "</a> " . close_dangling_tags($user['status']) . "</small><br />";
$clann = mysql_fetch_array(mysql_query("SELECT `name`,`short` FROM `clans` WHERE `id` = '{$user['klan']}' LIMIT 1"));
$r .= "<a href='/encicl/index.php?section=99&page=clans1&clan=" . close_dangling_tags($clann['short']) . "' target='_blank'>" . close_dangling_tags($clann['name']) . "</a> " . close_dangling_tags($user['status']) . "</small><br />";
} elseif ($user['align'] > 0) {
if ((int)$user['align'] == 1) {
$r .= "<b>Орден Паладинов</b> {$user['status']}<br /></small>";
@ -2765,7 +2746,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false)
}
function getDateInterval($pointDate)
{
{//FIXME Лолшто?! ))))))
$pointNow = time();
$times = array('year' => 60 * 60 * 24 * 365, 'month' => 60 * 60 * 24 * 31, 'week' => 60 * 60 * 24 * 7, 'day' => 60 * 60 * 24, 'hour' => 60 * 60, 'minute' => 60);
$pointInterval = $pointDate > $pointNow ? $pointDate - $pointNow : $pointNow - $pointDate;
@ -2781,7 +2762,7 @@ function getDateInterval($pointDate)
$returnDate['hour'] = floor($pointInterval / $times['hour']);
$pointInterval = $pointInterval % $times['hour'];
$returnDate['minute'] = floor($pointInterval / $times['minute']);
$pointInterval = $pointInterval % $times['minute'];
// $pointInterval = $pointInterval % $times['minute'];
return $returnDate;
}
@ -3708,7 +3689,7 @@ function show_shop_items($it, $from = 'shop')
return $r;
}
function showitem($row, $type, $link = '', $returned = false)
function showitem($row, $type, $returned = false)
{
global $user, $runes_exp;
$returnHTML = '';
@ -3716,7 +3697,6 @@ function showitem($row, $type, $link = '', $returned = false)
destructitem($row['id']);
}
$dr = '';
$magic = magicinf($row['magic']);
$incmagic = mysql_fetch_array(mysql_query('SELECT * FROM `magic` WHERE `id` = \'' . $row['includemagic'] . '\' LIMIT 1;'));
$incmagic['name'] = $row['includemagicname'];
@ -4036,7 +4016,7 @@ function showitem($row, $type, $link = '', $returned = false)
echo $returnHTML;
}
function show_item($row, $type, $txt, $place)
function show_item($row, $txt, $place)
{
if (($row['maxdur'] <= $row['duration']) || ($row['dategoden'] && $row['dategoden'] <= time())) destructitem($row['id']);
$r = '';
@ -4292,7 +4272,6 @@ function magicinf($id)
// показать перса в инфе
function showpersinv($id)
{
global $mysql;
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1;"));
$dressed = array();
$r = mysql_query("SELECT * FROM `inventory` WHERE `id` = '$user[helm]' OR `id` = '$user[weap]' OR `id` = '$user[plaw]' OR `id` = '$user[bron]' OR `id` = '$user[rybax]' OR `id` = '$user[belt]' OR `id` = '$user[sergi]' OR `id` = '$user[kulon]' OR `id` = '$user[r1]' OR `id` = '$user[r2]' OR `id` = '$user[r3]' OR `id` = '$user[perchi]' OR `id` = '$user[shit]' OR `id` = '$user[leg]' OR `id` = '$user[boots]' OR `id` = '$user[m1]' OR `id` = '$user[m2]' OR `id` = '$user[m3]' OR `id` = '$user[m4]' OR `id` = '$user[m5]' OR `id` = '$user[m6]' OR `id` = '$user[m7]' OR `id` = '$user[m8]' OR `id` = '$user[m9]' OR `id` = '$user[m10]' OR `id` = '$user[m11]' OR `id` = '$user[m12]'");
@ -4576,7 +4555,6 @@ function showpersinv($id)
function show_rune($slot, $uid, $type = 0)
{
global $user, $runes_exp;
$r = '';
$us = mysql_fetch_array(mysql_query('SELECT `id`, `rune_1`, `rune_2`, `rune_3` FROM `users` WHERE `id` = "' . $uid . '" LIMIT 1'));
if (isset($us['id'])) {
if ($us['rune_' . $slot] > 0) {
@ -4613,73 +4591,73 @@ function dropitemid_cave($slot, $id)
global $user;
switch ($slot) {
case 'sergi':
$slot1 = 1;
$slot = 1;
break;
case 'kulon':
$slot1 = 2;
$slot = 2;
break;
case 'weap':
$slot1 = 3;
$slot = 3;
break;
case 'bron':
$slot1 = 4;
$slot = 4;
break;
case 'r1':
$slot1 = 5;
$slot = 5;
break;
case 'r2':
$slot1 = 6;
$slot = 6;
break;
case 'r3':
$slot1 = 7;
$slot = 7;
break;
case 'helm':
$slot1 = 8;
$slot = 8;
break;
case 'perchi':
$slot1 = 9;
$slot = 9;
break;
case 'shit':
$slot1 = 10;
$slot = 10;
break;
case 'boots':
$slot1 = 11;
$slot = 11;
break;
case 'm1':
$slot1 = 12;
$slot = 12;
break;
case 'm2':
$slot1 = 13;
$slot = 13;
break;
case 'm3':
$slot1 = 14;
$slot = 14;
break;
case 'm4':
$slot1 = 15;
$slot = 15;
break;
case 'm5':
$slot1 = 16;
$slot = 16;
break;
case 'm6':
$slot1 = 17;
$slot = 17;
break;
case 'm7':
$slot1 = 18;
$slot = 18;
break;
case 'm8':
$slot1 = 19;
$slot = 19;
break;
case 'm9':
$slot1 = 20;
$slot = 20;
break;
case 'm10':
$slot1 = 21;
$slot = 21;
break;
case 'rybax':
$slot1 = 22;
$slot = 22;
break;
case 'plaw':
$slot1 = 23;
$slot = 23;
break;
}
if (mysql_query('UPDATE `users`, `inventory` SET `users`.' . $slot . ' = 0, `inventory`.`dressed` = 0, `users`.`sila` = `users`.`sila` - `inventory`.`gsila`, `users`.`lovk` = `users`.`lovk` - `inventory`.`glovk`, `users`.`inta` = `users`.`inta` - `inventory`.`ginta`, `users`.`intel` = `users`.`intel` - `inventory`.`gintel`, `users`.`maxhp` = `users`.`maxhp` - `inventory`.`ghp`, `users`.`noj` = `users`.`noj` - `inventory`.`gnoj`, `users`.`topor` = `users`.`topor` - `inventory`.`gtopor`, `users`.`dubina` = `users`.`dubina` - `inventory`.`gdubina`, `users`.`mec` = `users`.`mec` - `inventory`.`gmech`, `users`.`mfire` = `users`.`mfire` - `inventory`.`gfire`, `users`.`mwater` = `users`.`mwater` - `inventory`.`gwater`, `users`.`mair` = `users`.`mair` - `inventory`.`gair`, `users`.`mearth` = `users`.`mearth` - `inventory`.`gearth`, `users`.`mlight` = `users`.`mlight` - `inventory`.`glight`, `users`.`mgray` = `users`.`mgray` - `inventory`.`ggray`, `users`.`mdark` = `users`.`mdark` - `inventory`.`gdark`, `users`.`fkrit` = `users`.`fkrit` - `inventory`.`mfkrit`, `users`.`fakrit` = `users`.`fakrit` - `inventory`.`mfakrit`, `users`.`fuvorot` = `users`.`fuvorot` - `inventory`.`mfuvorot`, `users`.`fauvorot` = `users`.`fauvorot` - `inventory`.`mfauvorot`, `users`.`ubron1` = `users`.`ubron1` - `inventory`.`bron1`, `users`.`ubron2` = `users`.`ubron2` - `inventory`.`bron2`, `users`.`ubron3` = `users`.`ubron3` - `inventory`.`bron3`, `users`.`ubron4` = `users`.`ubron4` - `inventory`.`bron4`, `users`.`uminu` = `users`.`uminu` - `inventory`.`minu`, `users`.`umaxu` = `users`.`umaxu` - `inventory`.`maxu` WHERE `inventory`.`id` = `users`.' . $slot . ' AND `inventory`.`dressed` = 1 AND `inventory`.`owner` = "' . $user['id'] . '" AND `users`.`id` = "' . $user['id'] . '"')) {
@ -4696,7 +4674,6 @@ function dropitemid_cave($slot, $id)
function del_effs($uid, $eff, $txt)
{
$text = '';
$pers = mysql_fetch_array(mysql_query('SELECT `id`, `login`, `sila`, `lovk`, `inta`, `vinos`, `intel`, `hp`, `maxhp` FROM `users` WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'));
if (isset($pers['id'])) {
$effect = mysql_fetch_array(mysql_query('SELECT `id`, `type`, `name`, `time`, `sila`, `lovk`, `inta`, `vinos`, `hp`, `proc_exp`, `owner`, `sleep`, `lastup`, `can` FROM `effects` WHERE `id` = "' . mysql_real_escape_string($eff) . '" AND `owner` = "' . $pers['id'] . '" LIMIT 1'));
@ -4823,7 +4800,7 @@ function dropitemid($slot, $id)
// снять предмет
function dropitem($slot)
{
global $user, $mysql;
global $user;
switch ($slot) {
case 1:
$slot1 = 'sergi';
@ -4943,7 +4920,6 @@ function dropitem($slot)
$wear_arr[] = $wear_list['prototype'];
};
$temp_is = array();
$item['id'] = $user[$slot1];
//foreach($wear_arr as $wt) echo($wt."<BR>");
@ -5019,7 +4995,7 @@ function dropitem($slot)
//сможет держать
function derj($id)
{
global $user, $mysql;
global $user;
$ts = mysql_fetch_array(mysql_query('SELECT `id`, `nalign` FROM `inventory` WHERE `id` = "' . $id . '" LIMIT 1'));
$al = '(1 = 1)';
if ($ts['nalign'] > 0) {
@ -5073,9 +5049,9 @@ function make_seed()
return (float)$sec + ((float)$usec * 100000);
}
function ref_drop($id)
function ref_drop()
{
global $user, $mysql;
global $user;
$slot = array('sergi', 'kulon', 'weap', 'bron', 'r1', 'r2', 'r3', 'helm', 'perchi', 'shit', 'boots', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10');
for ($i = 0; $i <= 20; $i++) {
if ($user[$slot[$i]] && !derj($user[$slot[$i]])) {
@ -5132,15 +5108,6 @@ function countmf()
$bmfbron = 0;
}
$bmfuv = 0;
$bmfauv = 0;
$bmfakrit = 0;
$bmfkrit = 0;
$bmfuv1 = 0;
$bmfauv1 = 0;
$bmfakrit1 = 0;
$bmfkrit1 = 0;
$mf = array();
$ud_raw = mysql_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` = \'' . $user['id'] . '\' LIMIT 1');
@ -5189,7 +5156,7 @@ function countmf()
// одеть предмет
function dressitem($id)
{
global $mysql, $user;
global $user;
$item = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` AS `i` WHERE `duration` < `maxdur` AND `id` = '{$id}' AND `owner` = '{$user['id']}' AND `dressed` = 0 LIMIT 1"));
switch ($item['type']) {
case 1:
@ -5468,7 +5435,6 @@ function dressitemkomplekt($id, $idd)
// убить предмет
function destructitem($id)
{
global $mysql;//$user,
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `id` = '{$id}' LIMIT 1;"));
switch ($dress['type']) {
@ -5574,9 +5540,9 @@ function destructitem($id)
}
// использовать магию
function usemagic($id, $target)
function usemagic($id)
{
global $user, $mysql, $fbattle;;
global $user;
$row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1"));
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id` = '{$user['battle']}' LIMIT 1"));
$all_magic = unserialize($bat['magic']);
@ -5982,7 +5948,6 @@ function addlog($id, $log)
function max_mf()
{
global $user;
$r = '';
$mfs = countmf();
if (($mfs['fkrit'] > $mfs['fakrit']) && ($mfs['fkrit'] > $mfs['fuvorot']) && ($mfs['fkrit'] > $mfs['fauvorot'])) {
@ -6029,7 +5994,7 @@ function bron_ads($a1, $a2, $a3, $a4, $col)
function dressitem2($id)
{
global $mysql, $user;
global $user;
$item = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `duration` < `maxdur` AND `id` = '{$id}' AND `dressed` = 0; "));
switch ($item['type']) {
case 1:
@ -6261,18 +6226,12 @@ function SolveExp($at_id, $def_id, $damage)
$result = ($baseexp[$def['level']]) * ($def_cost[0] / (($at_cost[0] + $def_cost[0]) / 2)) * ($damage / $def['maxhp']) * $expmf * $mfit * $mfbot * $mfbot2;
$result = $result / 3;
$result = round($result, 0);
$debug_result = "\r\nEXP baseexp[def['level']])=" . $baseexp[$def['level']]
. ") * (def_cost[0]=" . $def_cost[0] . "/((at_cost[0]" . $at_cost[0] . "+ def_cost[0]=" . $def_cost[0]
. ")/2))*(damage=" . $damage . "/def['maxhp']=" . $def['maxhp'] . ")* expmf=" . $expmf
. " * mfit=" . $mfit . " * mfbot=" . $mfbot . "* mfbot2=" . $mfbot2 . " Result => " . $result . "";
#echo $debug_result;
return $result;
}
function vCode($LocID, $Stamp)
{
return md5(sha1($LocID . SECURECODE . $Stamp));
return md5(sha1($LocID . $Stamp));
}
?>