code inspect

This commit is contained in:
Igor Barkov (iwork) 2019-09-16 17:01:59 +03:00
parent e93f8ebca1
commit 77e8b7de2a
8 changed files with 31 additions and 73 deletions

View File

@ -28,7 +28,10 @@ function setProfession($name, $type, $needMoney, $needLevel)
if ($name == 'наёмник') $profId = 21; if ($name == 'наёмник') $profId = 21;
if ($name == 'лекарь') $profId = 22; if ($name == 'лекарь') $profId = 22;
if (!empty($profId)) { if (!empty($profId)) {
db::c()->query('UPDATE `users` SET ?f = ?i, `money` = `money` - ?i WHERE `id` = ?i', 'prof' . $type, $profId, $needMoney, $_SESSION['uid']); try {
db::c()->query('UPDATE `users` SET ?f = ?i, `money` = `money` - ?i WHERE `id` = ?i', 'prof' . $type, $profId, $needMoney, $_SESSION['uid']);
} catch (\Krugozor\Database\Mysql\Exception $e) {
}
$deloText = "{$user['login']} купил профессию «{$name}» в академии за {$needMoney} кр."; $deloText = "{$user['login']} купил профессию «{$name}» в академии за {$needMoney} кр.";
addToDelo($deloText); addToDelo($deloText);
$user['prof'.$type] = true; $user['prof'.$type] = true;
@ -42,16 +45,20 @@ if ($get == 'mercenary') $status = setProfession('наёмник', 2, 700, 5);
if ($get == 'medic') $status = setProfession('лекарь', 2, 700, 5); if ($get == 'medic') $status = setProfession('лекарь', 2, 700, 5);
if ($get == 'exit') { if ($get == 'exit') {
db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 2702, `online`.`room` = 2702 WHERE `users`.`id` = ?i AND `online`.`id` = ?i', $_SESSION['uid'], $_SESSION['uid']); try {
db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 2702, `online`.`room` = 2702 WHERE `users`.`id` = ?i AND `online`.`id` = ?i', $_SESSION['uid'], $_SESSION['uid']);
} catch (\Krugozor\Database\Mysql\Exception $e) {
}
header('Location: city.php'); header('Location: city.php');
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="ru">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link href="css/main.css" rel="stylesheet"> <link href="css/main.css" rel="stylesheet">
<link href="css/secondary.css" rel="stylesheet"/> <link href="css/secondary.css" rel="stylesheet"/>
<title></title>
</head> </head>
<body> <body>
<div style="float: right;"> <div style="float: right;">

View File

@ -77,7 +77,7 @@ $shopCategory = '';
$shopCategoryTypeNumber = empty($_GET['otdel']) ?: $_GET['otdel']; $shopCategoryTypeNumber = empty($_GET['otdel']) ?: $_GET['otdel'];
switch ($shopCategoryTypeNumber) { switch ($shopCategoryTypeNumber) {
default: default:
$shopCategory = "Кастеты и ножи"; $shopCategory = "Прихожая";
break; break;
case 1: case 1:
$shopCategory = "Кастеты и ножи"; $shopCategory = "Кастеты и ножи";

View File

@ -20,3 +20,9 @@
</script> </script>
</body> </body>
</html> </html>
<?php
/*
* Скамейка - level20 - room 223
* Средняя скамейка - level21 - room 222
* Малая скамейка - level22 - room224
*/

View File

@ -1,22 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="css/main.css" rel="stylesheet"/>
<title>Скамейка</title>
</head>
<body>
<a onclick="returned()"> на главную</a>
<h1>Скамейка</h1>
<p>
Если вы устали от шума боев и суеты центральных улиц, вы можете отдохнуть на скамейке под тенью парковых деревьев...<br>
Здесь можно, уединившись, подумать о вечном, назначить романтическое свидание или просто спокойно поболтать.<br>
Если только местные хулиганы не помешают вам
</p>
<script>
function returned() {
location.href='city.php?bps=1&tmp='+Math.random();
}
</script>
</body>
</html>

View File

@ -1,22 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="css/main.css" rel="stylesheet"/>
<title>Скамейка</title>
</head>
<body>
<a onclick="returned()"> на главную</a>
<h1>Скамейка</h1>
<p>
Если вы устали от шума боев и суеты центральных улиц, вы можете отдохнуть на скамейке под тенью парковых деревьев...<br>
Здесь можно, уединившись, подумать о вечном, назначить романтическое свидание или просто спокойно поболтать.<br>
Если только местные хулиганы не помешают вам
</p>
<script>
function returned() {
location.href='city.php?bps=1&tmp='+Math.random();
}
</script>
</body>
</html>

View File

@ -249,10 +249,10 @@ switch ($location[0]) {
move(223, 'bench.php'); move(223, 'bench.php');
break; break;
case 'level21': case 'level21':
move(222, 'bench_s.php'); move(222, 'bench.php');
break; break;
case 'level22': case 'level22':
move(224, 'bench_m.php'); move(224, 'bench.php');
break; break;
case 'level7': case 'level7':
move(777, 'obshaga.php'); move(777, 'obshaga.php');
@ -293,13 +293,13 @@ function bgset($img)
$daytime = date('H'); $daytime = date('H');
if ($daytime >= 6 && $daytime <= 21) $background = getSeason() . $img . '_day'; if ($daytime >= 6 && $daytime <= 21) $background = getSeason() . $img . '_day';
else $background = getSeason() . $img . '_night'; else $background = getSeason() . $img . '_night';
echo sprintf('<div style="position:relative; display: inline-block;" id="ione"><img src="i/city/%s.jpg">', $background); echo sprintf('<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="i/city/%s.jpg">', $background);
} }
$online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time() - 60)); $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time() - 60));
?> ?>
<!doctype html> <!doctype html>
<html> <html lang="ru">
<HEAD> <HEAD>
<link rel=stylesheet href="css/main.css"> <link rel=stylesheet href="css/main.css">
<meta charset="utf-8"> <meta charset="utf-8">
@ -320,6 +320,7 @@ $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time
document.onmousedown = Down; document.onmousedown = Down;
</script> </script>
<title></title>
</HEAD> </HEAD>
<body> <body>
<table width=100% border=0 cellspacing="0" cellpadding="0"> <table width=100% border=0 cellspacing="0" cellpadding="0">
@ -416,6 +417,5 @@ $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time
</td> </td>
</tr> </tr>
</table> </table>
<script language="javascript" src="js/refreshonline.js"></script>
</body> </body>
</html> </html>

View File

@ -1,3 +0,0 @@
//top.localroom=top.changeroom;
//top.frames['online'].location='ch.php?online='+Math.round(Math.random()*100000);
//<script language="javascript" src="ajax/refreshonline.js"></script>

View File

@ -63,9 +63,9 @@ function stack($it_id)
{ {
global $user; global $user;
$it_id = (int)$it_id; $it_id = (int)$it_id;
$stack = mysql_query("SELECT * FROM `inventory` WHERE `id` = '" . $it_id . "' AND `owner` = " . $user['id'] . " LIMIT 1"); $stack = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', $it_id, $user['id']);
if (mysql_num_rows($stack) == 1) { if (db::c()->getAffectedRows() === 1) {
$stack = mysql_fetch_array($stack); $stack = $stack->fetch_assoc();
$similar = mysql_fetch_array(mysql_query("SELECT SUM(`koll`) FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `laba` = '" . $stack['laba'] . "' AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `dressed` = 0 AND `goden` = 0 AND `setsale` = 0 AND `koll` >= 1 AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2) = FORMAT(" . ($stack['cost'] / $stack['koll']) . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2)")); $similar = mysql_fetch_array(mysql_query("SELECT SUM(`koll`) FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `laba` = '" . $stack['laba'] . "' AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `dressed` = 0 AND `goden` = 0 AND `setsale` = 0 AND `koll` >= 1 AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2) = FORMAT(" . ($stack['cost'] / $stack['koll']) . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2)"));
if ($similar[0] >= 1) { if ($similar[0] >= 1) {
mysql_query("UPDATE `inventory` SET `cost` = (`cost`+`cost`/`koll`*" . $similar[0] . "), `point` = (`point`+`point`/`koll`*" . $similar[0] . "), `bcost` = (`bcost`+`bcost`/`koll`*" . $similar[0] . "), `massa` = (`massa`+`massa`/`koll`*" . $similar[0] . "), `koll` = (`koll`+" . $similar[0] . "), `gmeshok` = (`gmeshok`+`gmeshok`*" . $similar[0] . ") WHERE `id` = '" . $stack['id'] . "' LIMIT 1"); mysql_query("UPDATE `inventory` SET `cost` = (`cost`+`cost`/`koll`*" . $similar[0] . "), `point` = (`point`+`point`/`koll`*" . $similar[0] . "), `bcost` = (`bcost`+`bcost`/`koll`*" . $similar[0] . "), `massa` = (`massa`+`massa`/`koll`*" . $similar[0] . "), `koll` = (`koll`+" . $similar[0] . "), `gmeshok` = (`gmeshok`+`gmeshok`*" . $similar[0] . ") WHERE `id` = '" . $stack['id'] . "' LIMIT 1");
@ -822,7 +822,7 @@ if (input::get('setch')) {
var perm = getCurrentPermission(); var perm = getCurrentPermission();
if (perm == 'true') { if (perm === 'true') {
new Notification('Thenks'); new Notification('Thenks');
} else { } else {
Notification.requestPermission('Сайт запрашивает доступ к уведомлениям.'); Notification.requestPermission('Сайт запрашивает доступ к уведомлениям.');
@ -1586,11 +1586,11 @@ if (input::get('edit')) {
function okno(title, script, name, coma, errk) { function okno(title, script, name, coma, errk) {
var errkom = ''; var errkom = '';
var com = ''; var com = '';
if (errk == 1) { if (errk === 1) {
errkom = 'Нельзя использовать символы: /\:*?"<>|+%<br>'; errkom = 'Нельзя использовать символы: /\:*?"<>|+%<br>';
com = coma com = coma
} }
if (errk == 2) { if (errk === 2) {
errkom = 'Такой комплект уже существует<br>'; errkom = 'Такой комплект уже существует<br>';
com = coma com = coma
} }
@ -1625,7 +1625,7 @@ if (input::get('edit')) {
$(document).ready(function () { $(document).ready(function () {
$('a').live('click', function () { $('a').live('click', function () {
if ($(this).attr('ajax') != undefined) { if ($(this).attr('ajax') !== undefined) {
var ajaxModule = $(this).attr('ajax'); var ajaxModule = $(this).attr('ajax');
switch (ajaxModule) { switch (ajaxModule) {
@ -2402,18 +2402,10 @@ if ($user['room'] == 650) {
header('Location: ul_clans.php'); header('Location: ul_clans.php');
die(); die();
} }
if ($user['room'] == 223) { if ($user['room'] == 222 OR $user['room'] == 223 OR $user['room'] == 224) {
header('Location: bench.php'); header('Location: bench.php');
die(); die();
} }
if ($user['room'] == 222) {
header('Location: bench_s.php');
die();
}
if ($user['room'] == 224) {
header('Location: bench_m.php');
die();
}
//БС //БС
if ($user['in_tower'] == 1) { if ($user['in_tower'] == 1) {
header('Location: towerin.php'); header('Location: towerin.php');