Файл: l2ps_v5/atakaarena2.php
Строк: 69
<?php
include("files/ini.php");
include("files/data.php");
$ref=rand(1,3);
$ref2=rand(1,3);
$game = mysql_query("SELECT * FROM `arena` WHERE `login`='$log' LIMIT 1 ");
$boi=mysql_num_rows($game);
if($boi==0){include_once("files/zag.php");echo'Вы находитесь не на арене!';include_once'files/down.php';exit;}
switch($tip) {
case 'mag':
$oke = mysql_query("SELECT * FROM `stan` WHERE `login`='$log' LIMIT 1 ");
$ar=mysql_num_rows($oke);
if($ar==1){ header ("Location: arena.php?"); exit;}
$a = @mysql_query("select * from `arena` WHERE `login`='$vrag' AND `hp`>'0' AND `lvl`>'20' ");
if (mysql_affected_rows()==0)
{
$ok = mysql_query("SELECT * FROM `arena` WHERE `login`!='$log' AND `hp`>'0' AND `login`!='$vrag' AND `lvl`>'20' ORDER BY RAND() LIMIT 1 ");
$arr1=mysql_num_rows($ok);
if($arr1==0){
$time = date("H:i:s");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Никого нет.', '".$log."')"); header ("Location: arena.php?"); exit;}
}
else{$ok = mysql_query("SELECT * FROM `arena` WHERE `login`='$vrag' LIMIT 1 ");}
while($arr=mysql_fetch_array($ok)){
$time = date("H:i:s");
if($udata16<="0"){
header ("Location: arena.php?&go=dead");}
if($arr[login]==$log){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы неможете бить самого себя.', '".$log."')"); header ("Location: arena.php?"); exit;}
if($arr[lvl]<20){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Игрок слижком низкого лвла чтоб его бить.', '".$log."')"); header ("Location: arena.php?"); exit;}
$time = date("H:i:s");
$hp=trim($udata16);
$allhp=trim($udata17);
$nick=$arr['login'];
$hpatk=$arr['hp'];
$hpatkall=$arr['hpall'];
$atk=$arr['atk'];
$zashita=$arr['zashita'];
$id=$arr['id'];
$allhp2=trim($hpatkall);
$die=trim($udat[5]);
$hp2=trim($hpatk);
$qi = mysql_query("SELECT * from `mag` WHERE `mag10`='".$log."' and `id`='".$name."' LIMIT 1");
if (mysql_affected_rows()==0)
{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - У вас нет такой магии.', '".$log."')"); header ("Location: arena.php?&vrag=$nick"); exit;
}
else
{
while($rowi=mysql_fetch_array($qi))
{
if($udata29<$rowi['mag1']){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Нехватает МР', '".$log."')"); header ("Location: arena.php?&vrag=$nick"); exit;}
if($rowi[mag5]=="addhp"){
$udata16=$udata16+$rowi[mag0];
if($udata16>$udata17){$udata16=$udata17;}
mysql_query("UPDATE `users` SET `udata16`='$udata16' WHERE `udata0`='$log' LIMIT 1");
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы пополнили себе здоровье.', '".$log."')");
header ("Location: arena.php?&vrag=$nick");
}
if($rowi[mag5]=="yad"){
if($rowi[mag15]=="off"){
$mb = mysql_query("SELECT * from `arena` WHERE `id`='$id' ");
while($mob=mysql_fetch_array($mb)){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вас отравили. ', '".$mob[login]."')");
$actime=time()+60;
mysql_query("INSERT INTO
`yadusers` SET
`sila` = '$rowi[mag0]',
`iduser` = '$mob[login]',
`time` = '$actime'");
}}else{
$random=rand(1,3);
$mb = mysql_query("SELECT * from `arena` WHERE `login`!='$log' and `time`>'".time()."' LIMIT $random");
while($mob=mysql_fetch_array($mb)){
$mb = mysql_query("SELECT * from `yadusers` WHERE `id`='$id' ");
$mob=mysql_fetch_array($mb);
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вас отравили. ', '".$mob[login]."')");
$actime=time()+60;
mysql_query("INSERT INTO
`yadusers` SET
`sila` = '$rowi[mag0]',
`iduser` = '$mob[login]',
`time` = '$actime'");
}}
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы отравили врага.', '".$log."')");
header ("Location: arena.php?&vrag=$nick");
}
if($rowi[mag5]=="dezyad"){
mysql_query("DELETE FROM `yadusers` WHERE `iduser`='$log' LIMIT 1");
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы излечились от яда.', '".$log."')");
}
header ("Location: arena.php?&vrag=$nick");
}}}
break;
}
include_once"files/down.php";
?>