View file release_fix#2/mods/game/arena/battle.php

File size: 22.01Kb
<?php
session_start();
$mod_title="игра-арена";
$mod_status="on";
$update_status="ok";
if($mod_status=="on")
{
function mod_body($auth,$adminauth)
{
$level="";
$guildc="";
$arenac="";
if($auth=="ok")
{
$mcl="";
$mys="";
$mym="";
$myz="";
$myh="";
$query = "SELECT * FROM users WHERE login='$_COOKIE[login]'";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$pass,$mail,$reg,$class,$m,$h,$z,$s,$mon,$gold,$pms,$lvl,$ava,$ban,$online) = mysql_fetch_row($cat))
{
$mys=$s;
$mym=$m;
$myz=$z;
$myh=$h;
$mcl=$class;
$level=$lvl;
}
$query = "SELECT * FROM count";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$guild,$arena) = mysql_fetch_row($cat))
{
$guildc=$guild;
$arenac=$arena;
}
echo "
<img src='img/bo.png'> <a href='?do=game/char'>персонаж($level)</a>|<img src='img/bs.png'> <a href='?do=game/history'>история</a><br>
<br>
";
$_pg="0";
$ag="-10";
$_pg2="10";
if(!empty($_GET['_pg']))
{
$ag=$_GET['_pg']-"10";
$_pg=$_GET['_pg'];
$_pg2=$_GET['_pg']+"10";
}
$lgn="";
$query = "SELECT * FROM arena WHERE name='$_GET[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$name) = mysql_fetch_row($cat))
{
$lgn=$name;
}
if(!empty($_GET['login']))
{
}
else
{
$query = "SELECT * FROM arenabattle WHERE login2='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$s,$m,$z,$h,$login2,$s2,$m2,$z2,$h2) = mysql_fetch_row($cat))
{
$lgn="blablabla";
}

$iwin="";
$query = "SELECT * FROM arenabattleend WHERE login='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$login2,$win) = mysql_fetch_row($cat))
{
$iwin=$win;
}
if($iwin=="")
{
$query = "SELECT * FROM arenabattleend WHERE login2='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$login2,$win) = mysql_fetch_row($cat))
{
$iwin=$win;
}
}
if($iwin!="")
{
$lgn="blablabla";
}
}
if($lgn != "")
{
$bar="";
$query = "SELECT * FROM arenabattle WHERE login='$_GET[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$s,$m,$z,$h,$login2,$s2,$m2,$z2,$h2) = mysql_fetch_row($cat))
{
$bar=$login;
}
if(!empty($_GET['login']))
{
}
else
{
$query = "SELECT * FROM arenabattle WHERE login2='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$s,$m,$z,$h,$login2,$s2,$m2,$z2,$h2) = mysql_fetch_row($cat))
{
$bar="";
}
}
if($iwin!="")
{
$bar="";
}
if($bar == "")
{
$logon="";
if(!empty($_GET['login']))
{
$logon=$_GET['login'];
}
else
{
$logon="$_COOKIE[login]";
}
$bar="";
$barx="";
$query = "SELECT * FROM arenabattle WHERE login2='$logon' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$s,$m,$z,$h,$login2,$s2,$m2,$z2,$h2) = mysql_fetch_row($cat))
{
$barx=$login;
$bar=$login2;
}
$memtest="no";
if($bar == "" && !empty($_GET['login']))
{
$memtest="ok";
}
else if(!empty($_GET['login']) && $barx == $_COOKIE['login'])
{
$memtest="ok";
}
else if($bar=="$_COOKIE[login]")
{
$memtest="ok";
}
if($iwin!="")
{
$memtest="ok";
}
if($memtest=="ok")
{
$dt1="";
$query = "SELECT * FROM arenabattle WHERE login='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$s,$m,$z,$h,$login2,$s2,$m2,$z2,$h2,$hod,$time) = mysql_fetch_row($cat))
{
$dt1=$login2;
}
$iwin2="";
$query = "SELECT * FROM arenabattleend WHERE login='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$login2,$win) = mysql_fetch_row($cat))
{
$iwin2=$win;
}
if($dt1 != $_GET['login'] && $dt1 =="" && $iwin2=="")
{
$a1s="";
$a1m="";
$a1z="";
$a1h="";
$query = "SELECT * FROM users WHERE login='$_GET[login]'";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$pass,$mail,$reg,$class,$m,$h,$z,$s,$mon,$gold,$pms,$lvl,$ava,$ban,$online) = mysql_fetch_row($cat))
{
$a1s=$s;
$a1m=$m;
$a1z=$z;
$a1h=$h;
}
$timexxx=time();
$query = "INSERT INTO arenabattle (login,s,m,z,h,login2,s2,m2,z2,h2,hod,time) VALUES ('$_COOKIE[login]','$mys','$mym','$myz','$myh','$_GET[login]','$a1s','$a1m','$a1z','$a1h','$_COOKIE[login]',$timexxx)";
$result = mysql_query ($query)
or die ("<span style='color:red'>ошибка arena.arena.battle!</span>");
}
$dt1="";
$dt2="";
$logon2="";
if(!empty($_GET['login']))
{
$logon2=$_GET['login'];
}
else
{
$logon2=$_COOKIE['login'];
}
$query = "SELECT * FROM arenabattle WHERE login2='$logon2' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$s,$m,$z,$h,$login2,$s2,$m2,$z2,$h2,$hod,$time) = mysql_fetch_row($cat))
{
$dt2=$login;
$dt1=$login2;
}
if($iwin!="")
{
$i2win="";
$query = "SELECT * FROM arenabattleend WHERE login='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$login2,$win) = mysql_fetch_row($cat))
{
$i2win=$win;
}
if($i2win!="")
{
$dt2=$_COOKIE['login'];
}
else
{
$dt1=$_COOKIE['login'];
}
}
if($dt1 !=$_GET['login'] && !empty($_GET['login']) && $i2win !="")
{
echo "HACKER?!<br>";
exit();
}
if($_COOKIE['login']==$dt2)
{
$nowtime="";
$nowhod="";
$login2="";
$a2h="";
$my1s="";
$my1m="";
$my1h="";
$a2s="";
$a2m="";
$nh="";
$nowh="";
$query = "SELECT * FROM arenabattle WHERE login='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$s,$m,$z,$h,$login2x,$s2,$m2,$z2,$h2,$hod,$time) = mysql_fetch_row($cat))
{
$nh=$hod;
$nowh=$h;
$a2s=$s2;
$a2m=$m2;
$my1s=$s;
$my1m=$m;
$a2h=$h2;
$login2=$login2x;
$nowhod=$hod;
$nowtime=$time;
}
$iwin="";
$query = "SELECT * FROM arenabattleend WHERE login='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$login2,$win) = mysql_fetch_row($cat))
{
$iwin=$win;
}
if($iwin=="")
{
if($nowh<0)
{
$query = "INSERT INTO arenabattleend (login,login2,win) VALUES ('$_COOKIE[login]','$_GET[login]','$_GET[login]')";
$result = mysql_query ($query)
or die ("<span style='color:red'>ошибка arena.arena.battle!</span>");
$query="DELETE FROM arenabattle WHERE login='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("ошибка очистки!");
$query="DELETE FROM arenabattlelog WHERE login='$_COOKIE[login]$_GET[login]'";
$result=mysql_query($query)
or die("ошибка очистки!");
$mypvp="";
$query = "SELECT * FROM users WHERE login='$_COOKIE[login]'";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$pass,$mail,$reg,$class,$m,$h,$z,$s,$mon,$gold,$pms,$lvl,$ava,$ban,$online,$exp,$guild,$point2,$pvp) = mysql_fetch_row($cat))
{
$mypvp=$pvp;
}
$gavnopvp="";
$query = "SELECT * FROM users WHERE login='$_GET[login]'";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$pass,$mail,$reg,$class,$m,$h,$z,$s,$mon,$gold,$pms,$lvl,$ava,$ban,$online,$exp,$guild,$point2,$pvp) = mysql_fetch_row($cat))
{
$gavnopvp=$pvp;
}
$mypvp=$mypvp-5;
$gavnopvp=$gavnopvp+2;
$query="UPDATE users SET pvp='$mypvp' WHERE login='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления пользователя!</span><br>");
$query="UPDATE users SET pvp='$gavnopvp' WHERE login='".$_GET[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления пользователя!</span><br>");
echo "<span style='color:red'>Вы проиграли -5 PvP очков!</span><br>";
exit();
}
else if($a2h<0)
{
$query = "INSERT INTO arenabattleend (login,login2,win) VALUES ('$_COOKIE[login]','$_GET[login]','$_COOKIE[login]')";
$result = mysql_query ($query)
or die ("<span style='color:red'>ошибка arena.arena.battle!</span>");
$query="DELETE FROM arenabattle WHERE login='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("ошибка очистки!");
$query="DELETE FROM arenabattlelog WHERE login='$_COOKIE[login]$_GET[login]'";
$result=mysql_query($query)
or die("ошибка очистки!");
$mypvp="";
$query = "SELECT * FROM users WHERE login='$_COOKIE[login]'";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$pass,$mail,$reg,$class,$m,$h,$z,$s,$mon,$gold,$pms,$lvl,$ava,$ban,$online,$exp,$guild,$point2,$pvp) = mysql_fetch_row($cat))
{
$mypvp=$pvp;
}
$gavnopvp="";
$query = "SELECT * FROM users WHERE login='$_GET[login]'";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$pass,$mail,$reg,$class,$m,$h,$z,$s,$mon,$gold,$pms,$lvl,$ava,$ban,$online,$exp,$guild,$point2,$pvp) = mysql_fetch_row($cat))
{
$gavnopvp=$pvp;
}
$mypvp=$mypvp+2;
$gavnopvp=$gavnopvp-5;
$query="UPDATE users SET pvp='$mypvp' WHERE login='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления пользователя!</span><br>");
$query="UPDATE users SET pvp='$gavnopvp' WHERE login='".$_GET[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления пользователя!</span><br>");
echo "<span style='color:green'>Вы выиграли +2 PvP очков!</span><br>";
exit();
}
}
else
{
if($iwin==$_COOKIE['login'])
{
$query="DELETE FROM arenabattleend WHERE win='$iwin'";
$result=mysql_query($query)
or die("ошибка очистки!");
echo "<span style='color:red'>Вы выиграли +2 PvP очков!</span><br>";
exit();
}
else if($iwin=="")
{
}
else
{
$query="DELETE FROM arenabattleend WHERE win='$iwin'";
$result=mysql_query($query)
or die("ошибка очистки!");
echo "<span style='color:red'>Вы проиграли -5 PvP очков!</span><br>";
exit();
}
}
if(time()>$nowtime+15)
{
if($nowhod==$_COOKIE['login'])
{
$timexxx=time();
$query="UPDATE arenabattle SET hod='$_GET[login]',time='$timexxx' WHERE login='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления арены!</span><br>");
}
else
{
$timexxx=time();
$query="UPDATE arenabattle SET hod='$_COOKIE[login]',time='$timexxx' WHERE login='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления арены!</span><br>");
}
}
else
{
if($nowhod=="$_COOKIE[login]")
{
if($_GET['dox']=="attack")
{
$a2h=$a2h-$my1s;
$text="<img src=img/bb.png> $_COOKIE[login] нанес удар $_GET[login] -$my1s HP";
$query = "INSERT INTO arenabattlelog (login,text) VALUES ('$_COOKIE[login]$_GET[login]','$text')";
$result = mysql_query ($query)
or die ("<span style='color:red'>ошибка arena.arena.battle!</span>");
}
else if($_GET['dox']=="magic")
{
$a2h=$a2h-$my1m;
$text="<img src=img/bb.png> $_COOKIE[login] нанес магический удар $_GET[login] -$my1m HP";
$query = "INSERT INTO arenabattlelog (login,text) VALUES ('$_COOKIE[login]$_GET[login]','$text')";
$result = mysql_query ($query)
or die ("<span style='color:red'>ошибка arena.arena.battle!</span>");
}
if(!empty($_GET['dox']))
{
$timexxx=time();
$query="UPDATE arenabattle SET h2='$a2h',hod='$_GET[login]',time='$timexxx' WHERE login='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления арены!</span><br>");
}
}
else
{
}
$nowtime="";
$nowhod="";
$login2="";
$a2h="";
$my1s="";
$my1m="";
$my1h="";
$a2s="";
$a2m="";
$nh="";
$nowh="";
$query = "SELECT * FROM arenabattle WHERE login='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$s,$m,$z,$h,$login2x,$s2,$m2,$z2,$h2,$hod,$time) = mysql_fetch_row($cat))
{
$nh=$hod;
$nowh=$h;
$a2s=$s2;
$a2m=$m2;
$my1s=$s;
$my1m=$m;
$a2h=$h2;
$login2=$login2x;
$nowhod=$hod;
$nowtime=$time;
}
echo "
битва, $login2!<br>
жизни:$a2h<br>
<img src='img/bb.png'> <a href='?do=game/arena/battle&dox=attack&login=$_GET[login]'>ударить</a>|<img src='img/bb.png'> <a href='?do=game/arena/battle&dox=magic&login=$_GET[login]'>магия</a><br>
ваши жизни:$nowh<br>
<a href='?do=game/arena/battle&login=$_GET[login]'>[обновить]</a><br>
время хода:15 сек<br>
ходит:$nh<br>
лог битвы:<br>
";
$update_status="no";
$query = "SELECT * FROM arenabattlelog WHERE login='$_COOKIE[login]$login2' ORDER BY id DESC LIMIT 0,10";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$text) = mysql_fetch_row($cat))
{
echo "$text<br>";
}
echo "<br>";
echo "<a href='?do=game/arena/lost&dox=out'>[сбежать]</a><br>";
echo "<br>";
}
}
else if($_COOKIE['login']==$dt1)
{
$nowtime="";
$nowhod="";
$login2="";
$a2h="";
$my1s="";
$my1m="";
$my1h="";
$a2s="";
$a2m="";
$loginx="";
$nowh="";
$nh="";
$query = "SELECT * FROM arenabattle WHERE login2='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$s,$m,$z,$h,$login2x,$s2,$m2,$z2,$h2,$hod,$time) = mysql_fetch_row($cat))
{
$nh=$hod;
$nowh=$h2;
$loginx=$login;
$a2s=$s2;
$a2m=$m2;
$my1s=$s2;
$my1m=$m2;
$a2h=$h;
$login2=$login2x;
$nowhod=$hod;
$nowtime=$time;
}
$iwin="";
$query = "SELECT * FROM arenabattleend WHERE login2='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$login2,$win) = mysql_fetch_row($cat))
{
$iwin=$win;
}
if($iwin=="")
{
if($nowh<0)
{
$query1 = "INSERT INTO arenabattleend (login,login2,win) VALUES ('$loginx','$_COOKIE[login]','$loginx')";
$result = mysql_query ($query1)
or die ("<span style='color:red'>ошибка arena.arena.battle!</span>");
$query2="DELETE FROM arenabattle WHERE login2='".$_COOKIE[login]."'";
$result=mysql_query($query2)
or die("ошибка очистки!");
$query3="DELETE FROM arenabattlelog WHERE login='$loginx$_COOKIE[login]'";
$result=mysql_query($query3)
or die("ошибка очистки!");
$mypvp="";
$query = "SELECT * FROM users WHERE login='$_COOKIE[login]'";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$pass,$mail,$reg,$class,$m,$h,$z,$s,$mon,$gold,$pms,$lvl,$ava,$ban,$online,$exp,$guild,$point2,$pvp) = mysql_fetch_row($cat))
{
$mypvp=$pvp;
}
$gavnopvp="";
$query = "SELECT * FROM users WHERE login='$loginx'";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$pass,$mail,$reg,$class,$m,$h,$z,$s,$mon,$gold,$pms,$lvl,$ava,$ban,$online,$exp,$guild,$point2,$pvp) = mysql_fetch_row($cat))
{
$gavnopvp=$pvp;
}
$mypvp=$mypvp-5;
$gavnopvp=$gavnopvp+2;
$query="UPDATE users SET pvp='$mypvp' WHERE login='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления пользователя!</span><br>");
$query="UPDATE users SET pvp='$gavnopvp' WHERE login='$loginx'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления пользователя!</span><br>");
echo "<span style='color:red'>Вы проиграли -5 PvP очков!</span><br>";
exit();
}
else if($a2h<0)
{
$query = "INSERT INTO arenabattleend (login,login2,win) VALUES ('$loginx','$_COOKIE[login]','$_COOKIE[login]')";
$result = mysql_query ($query)
or die ("<span style='color:red'>ошибка arena.arena.battle!</span>");
$query4="DELETE FROM arenabattle WHERE login2='".$_COOKIE[login]."'";
$result=mysql_query($query4)
or die("ошибка очистки!");
$lgx123="$loginx$_COOKIE[login]";
$query5="DELETE FROM arenabattlelog WHERE login='$lgx123'";
$result=mysql_query($query5)
or die("ошибка очистки!");
$mypvp="";
$query = "SELECT * FROM users WHERE login='$_COOKIE[login]'";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$pass,$mail,$reg,$class,$m,$h,$z,$s,$mon,$gold,$pms,$lvl,$ava,$ban,$online,$exp,$guild,$point2,$pvp) = mysql_fetch_row($cat))
{
$mypvp=$pvp;
}
$gavnopvp="";
$query = "SELECT * FROM users WHERE login='$loginx'";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$pass,$mail,$reg,$class,$m,$h,$z,$s,$mon,$gold,$pms,$lvl,$ava,$ban,$online,$exp,$guild,$point2,$pvp) = mysql_fetch_row($cat))
{
$gavnopvp=$pvp;
}
$mypvp=$mypvp+2;
$gavnopvp=$gavnopvp-5;
$query="UPDATE users SET pvp='$mypvp' WHERE login='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления пользователя!</span><br>");
$query="UPDATE users SET pvp='$gavnopvp' WHERE login='$loginx'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления пользователя!</span><br>");
echo "<span style='color:green'>Вы выиграли +2 PvP очков!</span><br>";
exit();
}
}
else
{
if($iwin==$_COOKIE['login'])
{
$query="DELETE FROM arenabattleend WHERE win='$iwin'";
$result=mysql_query($query)
or die("ошибка очистки!");
echo "<span style='color:green'>Вы выиграли +2 PvP очков!</span><br>";
exit();
}
else if($iwin=="")
{
}
else
{
$query="DELETE FROM arenabattleend WHERE win='$iwin'";
$result=mysql_query($query)
or die("ошибка очистки!");
echo "<span style='color:red'>Вы проиграли -5 PvP очков!</span><br>";
exit();
}
}
if(time()>$nowtime+15)
{
if($nowhod==$_COOKIE['login'])
{
$timexxx=time();
$query="UPDATE arenabattle SET hod='$loginx',time='$timexxx' WHERE login2='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления арены!</span><br>");
}
else
{
$timexxx=time();
$query="UPDATE arenabattle SET hod='$_COOKIE[login]',time='$timexxx' WHERE login2='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления арены!</span><br>");
}
}
else
{
if($nowhod=="$_COOKIE[login]")
{
if($_GET['dox']=="attack")
{
$a2h=$a2h-$my1s;
$text=" <img src=img/bb.png> $_COOKIE[login] нанес удар $loginx -$my1s HP";
$query = "INSERT INTO arenabattlelog (login,text) VALUES ('$loginx$_COOKIE[login]','$text')";
$result = mysql_query ($query)
or die ("<span style='color:red'>ошибка arena.arena.battle!</span>");
}
else if($_GET['dox']=="magic")
{
$a2h=$a2h-$my1m;
$text=" <img src=img/bb.png> $_COOKIE[login] нанес магический удар $loginx -$my1m HP";
$query = "INSERT INTO arenabattlelog (login,text) VALUES ('$loginx$_COOKIE[login]','$text')";
$result = mysql_query ($query)
or die ("<span style='color:red'>ошибка arena.arena.battle!</span>");
}
if(!empty($_GET['dox']))
{
$timexxx=time();
$query="UPDATE arenabattle SET h='$a2h',hod='$loginx',time='$timexxx' WHERE login2='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления арены!</span><br>");
}
}
else
{
}
$nowtime="";
$nowhod="";
$login2="";
$a2h="";
$my1s="";
$my1m="";
$my1h="";
$a2s="";
$a2m="";
$loginx="";
$nowh="";
$nh="";
$query = "SELECT * FROM arenabattle WHERE login2='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$s,$m,$z,$h,$login2x,$s2,$m2,$z2,$h2,$hod,$time) = mysql_fetch_row($cat))
{
$nh=$hod;
$nowh=$h2;
$loginx=$login;
$a2s=$s2;
$a2m=$m2;
$my1s=$s2;
$my1m=$m2;
$a2h=$h;
$login2=$login2x;
$nowhod=$hod;
$nowtime=$time;
}
echo "
битва, $loginx!<br>
жизни:$a2h<br>
<img src='img/bb.png'> <a href='?do=game/arena/battle&dox=attack'>ударить</a>|<img src='img/bb.png'> <a href='?do=game/arena/battle&dox=magic'>магия</a><br>
ваши жизни:$nowh<br>
<a href='?do=game/arena/battle'>[обновить]</a><br>
время хода:15 сек<br>
ходит:$nh<br>
лог битвы:<br>
";
$update_status="no";
$query = "SELECT * FROM arenabattlelog WHERE login='$loginx$_COOKIE[login]' ORDER BY id DESC LIMIT 0,10";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$text) = mysql_fetch_row($cat))
{
echo "$text<br>";
}
echo "<br>";
echo "<a href='?do=game/arena/lost&dox=out'>[сбежать]</a><br>";
echo "<br>";
}
}
else
{
$i3win="";
$query = "SELECT * FROM arenabattleend WHERE login='$_COOKIE[login]' ORDER BY id DESC";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$login2,$win) = mysql_fetch_row($cat))
{
$i3win=$win;
}
if($i3win!="")
{
if($i3win==$_COOKIE['login'])
{
$query="DELETE FROM arenabattleend WHERE win='$i3win'";
$result=mysql_query($query)
or die("ошибка очистки!");
echo "<span style='color:red'>Вы выиграли +2 PvP очков!</span><br>";
exit();
}
else if($i3win=="")
{
}
else
{
$query="DELETE FROM arenabattleend WHERE win='$i3win'";
$result=mysql_query($query)
or die("ошибка очистки!");
echo "<span style='color:red'>Вы проиграли -5 PvP очков!</span><br>";
exit();
}
}
else
{
echo "Пользователь уже сражается!<br>";
$update_status="no";
}
}
}
else
{
echo "Пользователь уже сражается!<br>";
$update_status="no";
}
}
}
else
{
echo "Пользователь $_GET[login] не на арене!<br>";
$update_status="no";
}
if($update_status=="ok")
{
echo "<html>
<head>
<meta http-equiv='Refresh' content='0;URL=index.php?do=game/arena/battle&login=$_GET[login]&dox=$_GET[dox]'>
</head>
</html>";
}
include "data/buttons.auth.php";
}
else
{
echo "
Ошибка авторизации!<br>
";
}
}
}
else
{
function mod_body($auth,$adminauth)
{
echo "мод выключен администратором!<br>";
}
}
?>