Handle exceptions.
This commit is contained in:
parent
9ce4a48f42
commit
39c56ea1c1
37
main.php
37
main.php
@ -12,7 +12,11 @@ if (!isset($_SESSION['uid'])) {
|
|||||||
}
|
}
|
||||||
require_once 'functions.php';
|
require_once 'functions.php';
|
||||||
$tmaz = time();
|
$tmaz = time();
|
||||||
|
try {
|
||||||
db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `id` = ?i', time(), $user['id']);
|
db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `id` = ?i', time(), $user['id']);
|
||||||
|
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||||
|
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
|
||||||
|
}
|
||||||
if ($user['battle'] != 0) {
|
if ($user['battle'] != 0) {
|
||||||
header('location: fbattle.php');
|
header('location: fbattle.php');
|
||||||
die();
|
die();
|
||||||
@ -186,7 +190,11 @@ if ($user['room'] == 666) {
|
|||||||
|
|
||||||
function sum_mf($u)
|
function sum_mf($u)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$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);
|
$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);
|
||||||
|
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||||
|
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
|
||||||
|
}
|
||||||
if ($sum->fetch_assoc() > 0) {
|
if ($sum->fetch_assoc() > 0) {
|
||||||
return $sum;
|
return $sum;
|
||||||
} else {
|
} else {
|
||||||
@ -196,7 +204,11 @@ function sum_mf($u)
|
|||||||
|
|
||||||
function sum_dmg($u)
|
function sum_dmg($u)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$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);
|
$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);
|
||||||
|
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||||
|
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
|
||||||
|
}
|
||||||
if ($sum->fetch_assoc() > 0) {
|
if ($sum->fetch_assoc() > 0) {
|
||||||
return $sum;
|
return $sum;
|
||||||
} else {
|
} else {
|
||||||
@ -206,7 +218,11 @@ function sum_dmg($u)
|
|||||||
|
|
||||||
function sum_bron($u)
|
function sum_bron($u)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$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);
|
$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);
|
||||||
|
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||||
|
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
|
||||||
|
}
|
||||||
if ($sum->fetch_assoc() > 0) {
|
if ($sum->fetch_assoc() > 0) {
|
||||||
return $sum;
|
return $sum;
|
||||||
} else {
|
} else {
|
||||||
@ -1098,13 +1114,13 @@ if (input::get('edit')) {
|
|||||||
|
|
||||||
function setHPlocal() {
|
function setHPlocal() {
|
||||||
tkHP > maxHP && (tkHP = maxHP);
|
tkHP > maxHP && (tkHP = maxHP);
|
||||||
var a = Math.round(tkHP) + "/" + maxHP;
|
let a = Math.round(tkHP) + "/" + maxHP;
|
||||||
a = stLen - (a.length + 2) * 7;
|
a = stLen - (a.length + 2) * 7;
|
||||||
var b = Math.round((a - 1) / maxHP * tkHP);
|
const b = Math.round((a - 1) / maxHP * tkHP);
|
||||||
a -= b;
|
a -= b;
|
||||||
var HP = document.getElementById("hp_value");
|
const HP = document.getElementById("hp_value");
|
||||||
var HP1 = document.getElementById("HP1");
|
const HP1 = document.getElementById("HP1");
|
||||||
var HP2 = document.getElementById("HP2");
|
const HP2 = document.getElementById("HP2");
|
||||||
if (HP) {
|
if (HP) {
|
||||||
HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP;
|
HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP;
|
||||||
}
|
}
|
||||||
@ -1166,6 +1182,7 @@ if (input::get('edit')) {
|
|||||||
-webkit-border-radius: 5px;
|
-webkit-border-radius: 5px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<title></title>
|
||||||
</HEAD>
|
</HEAD>
|
||||||
<body>
|
<body>
|
||||||
<div id=hint3 class=ahint></div>
|
<div id=hint3 class=ahint></div>
|
||||||
@ -1641,13 +1658,13 @@ if (input::get('edit')) {
|
|||||||
|
|
||||||
function setHPlocal() {
|
function setHPlocal() {
|
||||||
tkHP > maxHP && (tkHP = maxHP);
|
tkHP > maxHP && (tkHP = maxHP);
|
||||||
var a = Math.round(tkHP) + "/" + maxHP;
|
let a = Math.round(tkHP) + "/" + maxHP;
|
||||||
a = stLen - (a.length + 2) * 7;
|
a = stLen - (a.length + 2) * 7;
|
||||||
var b = Math.round((a - 1) / maxHP * tkHP);
|
const b = Math.round((a - 1) / maxHP * tkHP);
|
||||||
a -= b;
|
a -= b;
|
||||||
var HP = document.getElementById("hp_value");
|
const HP = document.getElementById("hp_value");
|
||||||
var HP1 = document.getElementById("HP1");
|
const HP1 = document.getElementById("HP1");
|
||||||
var HP2 = document.getElementById("HP2");
|
const HP2 = document.getElementById("HP2");
|
||||||
if (HP) {
|
if (HP) {
|
||||||
HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP;
|
HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user