Избавляемся от mysql_query.

This commit is contained in:
Igor Barkov [iwork] 2018-06-22 17:35:54 +03:00
parent 36473235b0
commit 92d125a914
1 changed files with 190 additions and 170 deletions

View File

@ -1,214 +1,234 @@
<?php
session_start();
if($_SESSION['uid'] == null) { header("Location: index.php"); }
if ($_SESSION['uid'] == null) {
header("Location: index.php");
}
include("config.php");
include("functions.php");
$start = mysql_fetch_array(mysql_query('SELECT `value` FROM `variables` WHERE `var` = "arena_of_gods" LIMIT 1'));
$is_now = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `aren_of` = 1 AND `win` = 3 ORDER BY `id` DESC LIMIT 1'));
$eff = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '".$user['id']."' AND (`type` = 11 OR `type` = 12) LIMIT 1"));
$w = mysql_fetch_array(mysql_query('SELECT `value` FROM `variables` WHERE `var` = "arena_win" LIMIT 1'));
$start = db::c()->query('SELECT `value` FROM `variables` WHERE `var` = "arena_of_gods"')->fetch_assoc();
$is_now = db::c()->query('SELECT `id` FROM `battle` WHERE `aren_of` = 1 AND `win` = 3 ORDER BY `id` DESC')->fetch_assoc();
$eff = db::c()->query('SELECT `id` FROM `effects` WHERE `owner` = ?i AND (`type` = 11 OR `type` = 12)', $user['id'])->fetch_assoc();
$w = db::c()->query('SELECT `value` FROM `variables` WHERE `var` = "arena_win"')->fetch_assoc();
$al = aligntype($user['align']);
if($w['value'] == 1) {
$winers = 'Прошлая победа за Силами Тьмы';
} elseif($w['value'] == 2) {
$winers = 'Прошлая победа за Силами Света';
if ($w['value'] == 1) {
$winers = 'Прошлая победа за Силами Тьмы';
} elseif ($w['value'] == 2) {
$winers = 'Прошлая победа за Силами Света';
} else {
$winers = 'Прошлая битва завершилась ничьей.';
$winers = 'Прошлая битва завершилась ничьей.';
}
$error = '';
if(isset($_GET['append'])) {
if($_GET['append'] == 1) { ##### team 2
if($al == 1 || $al == 3) {
if(isset($is_now['id'])) {
if(!isset($eff['id'])) {
if($user['level'] >= 7) {
if($user['hp'] > $user['maxhp']*0.33) {
if($user['align'] != 4) {
if($is_now['time_m'] < (time()+60*60)) {
$bot = mysql_fetch_array(mysql_query('SELECT `id` FROM `bots` WHERE `battle` = "'.$is_now['id'].'" AND `prototype` = "10023" LIMIT 1'));
join_arena($user['id'], $is_now['id'], 2, $bot['id']);
if (isset($_GET['append'])) {
if ($_GET['append'] == 1) { ##### team 2
if ($al == 1 || $al == 3) {
if (isset($is_now['id'])) {
if (!isset($eff['id'])) {
if ($user['level'] >= 7) {
if ($user['hp'] > $user['maxhp'] * 0.33) {
if ($user['align'] != 4) {
if ($is_now['time_m'] < (time() + 60 * 60)) {
$bot = db::c()->query('SELECT `id` FROM `bots` WHERE `battle` = ?i AND `prototype` = 10023', $is_now['id'])->fetch_assoc();
join_arena($user['id'], $is_now['id'], 2, $bot['id']);
} else {
$error = 'Время истекло ...';
}
} else {
$error = 'Хаосникам тут не место ...';
}
} else {
$error = 'Вы слишком ослаблены ...';
}
} else {
$error = 'Данный вид поединков доступен с 7 уровня ...';
}
} else {
$error = 'Время истекло ...';
$error = 'Вы травмированны и не можете принять участие в поединке ...';
}
} else {
$error = 'Хаосникам тут не место ...';
}
} else {
$error = 'Вы слишком ослаблены ...';
$error = 'Поединок не найден ...';
}
} else {
$error = 'Данный вид поединков доступен с 7 уровня ...';
}
} else {
$error = 'Вы травмированны и не можете принять участие в поединке ...';
$error = 'Не Ваша склонность ...';
}
} else {
$error = 'Поединок не найден ...';
}
} else {
$error = 'Не Ваша склонность ...';
}
} elseif($_GET['append'] == 2) { ##### team 1
if($al == 2 || $al == 3) {
if(isset($is_now['id'])) {
if(!isset($eff['id'])) {
if($user['level'] >= 7) {
if($user['hp'] > $user['maxhp']*0.33) {
if($user['align'] != 4) {
if($is_now['time_m'] < (time()+60*60)) {
$bot = mysql_fetch_array(mysql_query('SELECT `id` FROM `bots` WHERE `battle` = "'.$is_now['id'].'" AND `prototype` = "10024" LIMIT 1'));
join_arena($user['id'], $is_now['id'], 1, $bot['id']);
} elseif ($_GET['append'] == 2) { ##### team 1
if ($al == 2 || $al == 3) {
if (isset($is_now['id'])) {
if (!isset($eff['id'])) {
if ($user['level'] >= 7) {
if ($user['hp'] > $user['maxhp'] * 0.33) {
if ($user['align'] != 4) {
if ($is_now['time_m'] < (time() + 60 * 60)) {
$bot = db::c()->query('SELECT `id` FROM `bots` WHERE `battle` = ?i AND `prototype` = 10024', $is_now['id'])->fetch_assoc();
join_arena($user['id'], $is_now['id'], 1, $bot['id']);
} else {
$error = 'Время истекло ...';
}
} else {
$error = 'Хаосникам тут не место ...';
}
} else {
$error = 'Вы слишком ослаблены ...';
}
} else {
$error = 'Данный вид поединков доступен с 7 уровня ...';
}
} else {
$error = 'Время истекло ...';
$error = 'Вы травмированны и не можете принять участие в поединке ...';
}
} else {
$error = 'Хаосникам тут не место ...';
}
} else {
$error = 'Вы слишком ослаблены ...';
$error = 'Поединок не найден ...';
}
} else {
$error = 'Данный вид поединков доступен с 7 уровня ...';
}
} else {
$error = 'Вы травмированны и не можете принять участие в поединке ...';
$error = 'Не Ваша склонность ...';
}
} else {
$error = 'Поединок не найден ...';
}
} else {
$error = 'Не Ваша склонность ...';
}
}
}
?>
<html>
<head>
<title>404</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="ru" />
<link rel="stylesheet" type="text/css" href="design/css/fight.css" />
<title>404</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta http-equiv="content-language" content="ru"/>
<link rel="stylesheet" type="text/css" href="design/css/fight.css"/>
</head>
<style>
.hs {
font-weight: bold;
font-size: 19px;
color: #8f0000;
font-family: arial;
text-align: center;
}
.hs {
font-weight: bold;
font-size: 19px;
color: #8f0000;
font-family: arial;
text-align: center;
}
.bt {
float: right;
border: solid 1px #b0b0b0;
margin-top: 1px;
margin-bottom: 2px;
font-size: 11px;
color: #191970;
background-color: white;
padding: 1px 6px;
}
.bt {
float: right;
border: solid 1px #b0b0b0;
margin-top: 1px;
margin-bottom: 2px;
font-size: 11px;
color: #191970;
background-color: white;
padding: 1px 6px;
}
.credenzaBox {
width: 800px;
height: 367px;
overflow: hidden;
}
.credenzaBox {
width: 800px;
height: 367px;
overflow: hidden;
}
.credenzaItem {
width: 540px;
margin: 15px 120px;
padding: 6px 10px;
/*border: 1px inset #e2e0e0; 299pxxx
background: rgba(226,224,224, 0.9);*/
text-align: center;
}
.credenzaItem {
width: 540px;
margin: 15px 120px;
padding: 6px 10px;
/*border: 1px inset #e2e0e0; 299pxxx
background: rgba(226,224,224, 0.9);*/
text-align: center;
}
.credenza-stateCaption {
text-align: center;
font-weight: bold;
margin-bottom: 12px;
color: #FFF;
font: 19px Arial, sans-serif;
text-shadow: red 1px 1px 0, red -1px -1px 0,
red -1px 1px 0, red 1px -1px 0;
/*
text-shadow: 3px 3px 2px rgba(0, 192, 173, 1);
font-size: 19px;
*/
}
.credenza-stateCaption {
text-align: center;
font-weight: bold;
margin-bottom: 12px;
color: #FFF;
font: 19px Arial, sans-serif;
text-shadow: red 1px 1px 0, red -1px -1px 0,
red -1px 1px 0, red 1px -1px 0;
.buttonContainer {
position: relative;
right: 0px;
top: 1px;
text-align: center;
overflow: hidden;
padding: 2px;
zoom: 1;
}
.contentContainer {
margin-left: auto;
margin-right: auto;
width: 800px;
height: auto;
position: relative;
}
h2 {
font-size: 13px;
margin-bottom: 0px;
color: #FFF;
font-family: verdana;
}
a {
font-weight: bold;
color: #FFF;
text-decoration: none;
}
a:hover {
color: Red;
}
/*
text-shadow: 3px 3px 2px rgba(0, 192, 173, 1);
font-size: 19px;
*/
}
.buttonContainer {
position: relative;
right: 0px;
top: 1px;
text-align: center;
overflow: hidden;
padding: 2px;
zoom: 1;
}
.contentContainer {
margin-left: auto;
margin-right: auto;
width: 800px;
height: auto;
position: relative;
}
h2 {
font-size: 13px;
margin-bottom: 0px;
color: #FFF;
font-family: verdana;
}
a {
font-weight: bold;
color: #FFF;
text-decoration: none;
}
a:hover {
color: Red;
}
</style>
<body>
<center><div><span class="hs">Арена Ангелов</span></div></center>
<center>
<div><span class="hs">Арена Ангелов</span></div>
</center>
<div class="contentContainer">
<div class="buttonContainer">
<input type="button" onclick="location.href='city.php?bps=1';" class="bt" value="Вернуться" />
<input type="button" onclick="location.reload();" class="bt" value="Обновить" />
<div class="buttonContainer">
<input type="button" onclick="location.href='city.php?bps=1';" class="bt" value="Вернуться"/>
<input type="button" onclick="location.reload();" class="bt" value="Обновить"/>
</div>
<!-- url('/i/im/1724581.jpg') -->
<div class="credenzaBox" style="background: url('/i/im/u1001573_1407648022.jpg') no-repeat center;">
<div class="credenzaItem">
<? if (!isset($is_now['id'])) { ?>
<div class="credenza-stateCaption">
<center><? echo $winers; ?>.<br/>Следующая битва для 7-21 ур. состоится
: <? echo date("d.m.Y H:i", $start['value']); ?></center>
</div>
<? } else { ?>
<div class="credenza-stateCaption">
<h2>
<center>Идет сражение [7-21 уровни]</center>
</h2>
<br/><a href="/logs.php?log=<?= $is_now['id']; ?>" target="_blank" style="text-align: center;">ход
боя »»</a></div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td align="left">
<a href="?append=1" style="display: inline;"><img src="/i/im/append_1.png"
height="70"/><br/>Вмешаться</a>
</td>
<td align="center">
<img src="/i/im/logo_big2.png"/>
</td>
<td align="right">
<a href="?append=2" style="display: inline;"><img src="/i/im/append_2.png"
height="70"/><br/>Вмешаться</a>
</td>
</tr>
</tbody>
</table>
<? } ?>
</div>
</div>
</div>
<!-- url('/i/im/1724581.jpg') -->
<div class="credenzaBox" style="background: url('/i/im/u1001573_1407648022.jpg') no-repeat center;">
<div class="credenzaItem">
<? if(!isset($is_now['id'])) { ?>
<div class="credenza-stateCaption"><center><? echo $winers;?>.<br />Следующая битва для 7-21 ур. состоится : <? echo date("d.m.Y H:i", $start['value']);?></center></div>
<? } else { ?>
<div class="credenza-stateCaption"><h2><center>Идет сражение [7-21 уровни]</center></h2><br /><a href="/logs.php?log=<?=$is_now['id'];?>" target="_blank" style="text-align: center;">ход боя »»</a></div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td align="left">
<a href="?append=1" style="display: inline;"><img src="/i/im/append_1.png" height="70" /><br />Вмешаться</a>
</td>
<td align="center">
<img src="/i/im/logo_big2.png" />
</td>
<td align="right">
<a href="?append=2" style="display: inline;"><img src="/i/im/append_2.png" height="70" /><br />Вмешаться</a>
</td>
</tr>
</tbody>
</table>
<? } ?>
</div>
</div>
</div>
<center><? if($error != '') { echo '<b style=\'color: Red;\'>'.$error.'</b>'; } ?></center>
<center><? if ($error != '') {
echo '<b style=\'color: Red;\'>' . $error . '</b>';
} ?></center>
</body>
</html>