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

This commit is contained in:
Igor Barkov [iwork] 2018-06-22 17:35:54 +03:00
parent 36473235b0
commit 92d125a914

View File

@ -1,13 +1,15 @@
<?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) {
@ -29,7 +31,7 @@ if(isset($_GET['append'])) {
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'));
$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 = 'Время истекло ...';
@ -60,7 +62,7 @@ if(isset($_GET['append'])) {
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'));
$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 = 'Время истекло ...';
@ -153,6 +155,7 @@ if(isset($_GET['append'])) {
padding: 2px;
zoom: 1;
}
.contentContainer {
margin-left: auto;
margin-right: auto;
@ -160,23 +163,28 @@ if(isset($_GET['append'])) {
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">
@ -187,20 +195,30 @@ a:hover {
<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>
<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>
<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>
<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>
<a href="?append=2" style="display: inline;"><img src="/i/im/append_2.png"
height="70"/><br/>Вмешаться</a>
</td>
</tr>
</tbody>
@ -209,6 +227,8 @@ a:hover {
</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>