Фиксы запросов

This commit is contained in:
lopar
2018-02-27 04:48:51 +02:00
parent d37c2eeb87
commit 6c31594e9b
3 changed files with 123 additions and 267 deletions

View File

@@ -14,82 +14,31 @@ include('functions.php');
include('cave/cave_bots.php');
$cavebots = $botnames;
mysql_query("LOCK TABLES `bots` WRITE, `laba_obj` WRITE, `qst_user` WRITE, `qst` WRITE, `` WRITE, `battle` WRITE, `logs` WRITE, `users` WRITE, `inventory` WRITE, `magic` WRITE, `effects` WRITE, `online` WRITE, `clans` WRITE, `variables` WRITE, `logs_arena` WRITE, `cavebots` WRITE, `caveparties` WRITE");
db::c()->query('LOCK TABLES `bots` WRITE, `laba_obj` WRITE, `qst_user` WRITE, `qst` WRITE, `` WRITE, `battle` WRITE, `logs` WRITE, `users` WRITE, `inventory` WRITE, `magic` WRITE, `effects` WRITE, `online` WRITE, `clans` WRITE, `variables` WRITE, `logs_arena` WRITE, `cavebots` WRITE, `caveparties` WRITE');
if (isset($user['id'])) {
mysql_query("UPDATE `online` SET `real_time` = '" . time() . "' WHERE `id` = '{$user['id']}' LIMIT 1");
db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `id` = ?i', time(), $user['id']);
}
//include('./classes/battle_old.class.php');
include('./classes/battle_new.class.php');
$fbattle = new fbattle($user['battle']);
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
<meta content="text/html; charset=utf-8" http-equiv="Content-type"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="PRAGMA" content="NO-CACHE"/>
<meta http-equiv="Expires" content="0"/>
<link rel="stylesheet" href="css/main.css">
<meta charset="utf-8">
<script type="text/javascript" src="js/ZeroClipboard.js"></script>
<script type="text/javascript" src="js/sl2.js"></script>
<script type="text/javascript" src="js/ch.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/tooltip.js"></script>
<link rel="stylesheet" type="text/css" href="css/tooltip.css"/>
<script>
function ajaxFightRefresh() {
$.ajax({
url: '/fbattle.php?batl=' + $('#batl').val() + '&ajax=true',
cache: false,
type: "GET",
dataType: "html",
success: function (html) {
$('#fightContent').html(html);
}
});
}
function ajaxFightGo() {
var sendForm = {};
sendForm['enemy1'] = $('#enemy1').val();
sendForm['batl'] = $('#batl').val();
if ($('#fightType').val() == 1) {
sendForm['attack'] = $("input:radio:checked[name=attack]").val();
sendForm['defend'] = $("input:radio:checked[name=defend]").val();
sendForm['enemy'] = $('#enemy').val();
}
$.ajax({
url: '/fbattle.php?batl=' + $('#batl').val() + '&ajax=true',
cache: false,
type: "POST",
dataType: "html",
data: sendForm,
success: function (html) {
$('#fightContent').html(html);
if (document.forms["battleform"].go) {
document.forms["battleform"].go.focus();
}
if (document.forms["battleform"].battle) {
document.forms["battleform"].battle.focus();
}
if (document.forms["battleform"].end) {
document.forms["battleform"].end.focus();
}
return false;
}
});
return true;
}
</script>
<SCRIPT>
function refreshPeriodic() {
<?if($fbattle->battle) { ?>location.href = '<?=$_SERVER['PHP_SELF']?>?batl=<?=$_REQUEST['batl']?>';//reload();
<?php if($fbattle->battle) { ?>location.href = '<?=$_SERVER['PHP_SELF']?>?batl=<?=$_REQUEST['batl']?>';//reload();
<?}?>
timerID = setTimeout("refreshPeriodic()", 20000);
var timerID = setTimeout("refreshPeriodic()", 20000);
}
timerID = setTimeout("refreshPeriodic()", 20000);
</SCRIPT>
<script>
@@ -131,8 +80,8 @@ $fbattle = new fbattle($user['battle']);
}
function refreshPeriodic() {
<? if($fbattle->battle) { ?>location.href = '<?=$_SERVER['PHP_SELF']?>?batl=<?=$_REQUEST['batl']?>'; <? } ?>
timerID = setTimeout("refreshPeriodic()", 30000);
<?php if($fbattle->battle) { ?>location.href = '<?=$_SERVER['PHP_SELF']?>?batl=<?=$_REQUEST['batl']?>'; <? } ?>
var timerID = setTimeout("refreshPeriodic()", 30000);
}
timerID = setTimeout("refreshPeriodic()", 30000);
@@ -140,7 +89,7 @@ $fbattle = new fbattle($user['battle']);
function checksubmit() {
var ajaxload = 1;
if (ajaxload > 0) {
var enemy = <? echo $fbattle->enemy; ?>;
var enemy = <?=$fbattle->enemy;?>;
var batl = <?=($user['battle'] ? $user['battle'] : $_REQUEST['batl'])?>;
var tac_at = $('input[name=attack]:checked').val();
var att = "&attack=" + $('input[name=attack]:checked').val();
@@ -165,36 +114,6 @@ $fbattle = new fbattle($user['battle']);
}
}
function checksubmit_vip() {
var ajaxload = 1;
if (ajaxload > 0) {
var enemy = <? echo $fbattle->enemy; ?>;
var batl = <?=($user['battle'] ? $user['battle'] : $_REQUEST['batl'])?>;
var tac_at = <? echo mt_rand(1, 4); ?>;
var att = "&attack=" + tac_at + "";
var def = <? echo mt_rand(1, 4); ?>;
$("#A" + tac_at + "").attr("checked", "checked");
$("#D" + def + "").attr("checked", "checked");
if (tac_at > 0 && def > 0) {
$.ajax({
url: "fbattle.php",
type: "POST",
cache: false,
data: "batl=" + batl + "&myid=" + batl + att + "&defend=" + def + "&enemy=" + enemy + "",
success: function (html) {
$("body").html(html);
}
});
} else {
alert('Var error #1');
$("#at").prop("disabled", false);
}
} else {
document.f1.submit();
}
}
$("document").ready(function () {
$('#refresh').click(function () {
$.ajax({
@@ -209,66 +128,15 @@ $fbattle = new fbattle($user['battle']);
});
</script>
<style type="text/css">
.menu {
background-color: #d2d0d0;
border-color: #ffffff #626060 #626060 #ffffff;
border-style: solid;
border-width: 1px;
position: absolute;
left: 0px;
top: 0px;
visibility: hidden;
}
a.menuItem {
border: 0px solid #000000;
color: #003388;
display: block;
font-family: MS Sans Serif, Arial, Tahoma, sans-serif;
font-size: 8pt;
font-weight: bold;
padding: 2px 12px 2px 8px;
text-decoration: none;
}
a.menuItem:hover {
background-color: #a2a2a2;
color: #0066FF;
}
span {
font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;
text-decoration: none;
font-weight: bold;
cursor: pointer;
}
#hp_value {
font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;
text-decoration: none;
font-weight: normal;
}
.my_clip_button {
border: 0px solid #000000;
color: #003388;
display: block;
font-family: MS Sans Serif, Arial, Tahoma, sans-serif;
font-size: 8pt;
font-weight: bold;
padding: 2px 12px 2px 8px;
text-decoration: none;
}
.my_clip_button.hover {
background-color: #a2a2a2;
color: #0066FF;
}
</style>
</head>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=e2e0e0
onLoad="top.setHP(<?= $user['hp'] ?>,<?= $user['maxhp'] ?>)">
<body onLoad="top.setHP(<?= $user['hp'] ?>,<?= $user['maxhp'] ?>)">
<div id="hint3" class="ahint"></div>
<form action="<?= $_SERVER['PHP_SELF'] ?>" method="POST" name="f1" id="f1">
<table width=100% cellspacing=0 cellpadding=0 border=0>
@@ -281,14 +149,14 @@ $fbattle = new fbattle($user['battle']);
<table width=250 cellspacing=0 cellpadding=0>
<tr>
<td valign=top width=250 nowrap>
<? echo showinf_pers($user['id'], 1, 1, 1); ?>
<?php echo showinf_pers($user['id'], 1, 1, 1); ?>
</td>
</tr>
</table>
</td>
<td valign=top width=80%>
<? switch ($fbattle->return) {
<?php switch ($fbattle->return) {
case 1 :
?>
<table width=100% cellspacing=0 cellpadding=0>
@@ -296,9 +164,7 @@ $fbattle = new fbattle($user['battle']);
<td colspan=2><h3>Поединок</td>
</tr>
<tr>
<td>
<font color=660000><b>Ваш ход</b>
</td>
<td><font color=660000><b>Ваш ход</b></td>
<td align=right>&nbsp;</td>
</tr>
</table>
@@ -345,22 +211,30 @@ $fbattle = new fbattle($user['battle']);
<table cellspacing=0 cellpadding=0>
<tr>
<td>
<input type="radio" id="A1" name="attack" value="1" onclick="setattack()"/><label for="A1">удар в голову</label>
<input type="radio" id="A1" name="attack" value="1"
onclick="setattack()"/><label for="A1">удар в
голову</label>
</td>
</tr>
<tr>
<td>
<input type="radio" id="A2" name="attack" value="2" onclick="setattack()"/><label for="A2">удар в корпус</label>
<input type="radio" id="A2" name="attack" value="2"
onclick="setattack()"/><label for="A2">удар в
корпус</label>
</td>
</tr>
<tr>
<td>
<input type="radio" id="A3" name="attack" value="3" onclick="setattack()"/><label for="A3">удар в пояс(пах)</label>
<input type="radio" id="A3" name="attack" value="3"
onclick="setattack()"/><label for="A3">удар в
пояс(пах)</label>
</td>
</tr>
<tr>
<td>
<input type="radio" id="A4" name="attack" value="4" onclick="setattack()"/><label for="A4">удар по ногам</label>
<input type="radio" id="A4" name="attack" value="4"
onclick="setattack()"/><label for="A4">удар по
ногам</label>
</td>
</tr>
</table>
@@ -370,22 +244,30 @@ $fbattle = new fbattle($user['battle']);
<table cellspacing=0 cellpadding=0>
<tr>
<td>
<input type="radio" id="D1" name="defend" value="1" onclick="setdefend()"/><label for="D1">блок головы и корпуса</label>
<input type="radio" id="D1" name="defend" value="1"
onclick="setdefend()"/><label for="D1">блок головы и
корпуса</label>
</td>
</tr>
<tr>
<td>
<input type="radio" id="D2" name="defend" value="2" onclick="setdefend()"/><label for="D2">блок корпуса и пояса</label>
<input type="radio" id="D2" name="defend" value="2"
onclick="setdefend()"/><label for="D2">блок корпуса и
пояса</label>
</td>
</tr>
<tr>
<td>
<input type="radio" id="D3" name="defend" value="3" onclick="setdefend()"/><label for="D3">блок пояса и ног</label>
<input type="radio" id="D3" name="defend" value="3"
onclick="setdefend()"/><label for="D3">блок пояса и
ног</label>
</td>
</tr>
<tr>
<td>
<input type="radio" id="D4" name="defend" value="4" onclick="setdefend()"/><label for="D4">блок головы и ног</label>
<input type="radio" id="D4" name="defend" value="4"
onclick="setdefend()"/><label for="D4">блок головы и
ног</label>
</td>
</tr>
</table>
@@ -396,14 +278,18 @@ $fbattle = new fbattle($user['battle']);
<table cellspacing=0 cellpadding=0 width=100%>
<tr>
<td align=center>
<input type="submit" name="go" value="Ударить!" onclick="this.disabled = true; checksubmit(); return false;" id="at"/>
<input type="submit" name="go" value="Ударить!"
onclick="this.disabled = true; checksubmit(); return false;"
id="at"/>
</td><!--checksubmit(); -->
<td align=right>
<a onclick="location.href='<?= $_SERVER['PHP_SELF'] ?>?batl=<?= $_REQUEST['batl'] ?>';">
<img src='i/ico_refresh.gif' width=16 height=19 style='cursor:pointer' alt='Обновить'>
<img src='i/ico_refresh.gif' width=16 height=19
style='cursor:pointer' alt='Обновить'>
</a>
<a onClick="findlogin('Сменить противника', 'fbattle.php?smena=1', 'smena'); ">
<img src='ico_change.gif' width=16 height=19 style='cursor:pointer' alt='Сменить противника'>
<img src='ico_change.gif' width=16 height=19
style='cursor:pointer' alt='Сменить противника'>
</a>
</td>
</tr>
@@ -413,7 +299,7 @@ $fbattle = new fbattle($user['battle']);
<input type="hidden" name="enemy" value="<?= $fbattle->enemy ?>"/>
</TABLE>
</CENTER>
<?
<?
break;
case 2 :
if (($user['hp'] > 0) && $fbattle->battle) {
@@ -595,7 +481,7 @@ $fbattle = new fbattle($user['battle']);
<tr>
<td valign=top width=250 nowrap>
<center>
<?
<?php
if ($fbattle->return == 1) {
echo showinf_pers($fbattle->enemy, 1, 1);
@@ -641,12 +527,10 @@ $fbattle = new fbattle($user['battle']);
$fbattle->UpdateBattle();
}
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>