Файл: vkolhoze.com/arena/go_boy.php
Строк: 253
<?php
require_header ('Бой');
$user = $ku;
if(isset($_GET['LinkNoUser'])) echo "<div class='feedback'><ul><li class='title'><span>Извините, но c самим собой играть нельзя!</span></li><li></li></ul></div>";
echo "<div class='content'>";
echo '<div class="block">';
$udata2 = $ku;
$req1 = mysql_query("SELECT * FROM `arena` WHERE `lider` = '".$udata2['nick']."' or `oponent` = '".$udata2['nick']."' LIMIT 1");
$t = mysql_fetch_array($req1);
$time = time();
if($time > $t['timer'])
{
mysql_query("DELETE FROM `tmp_arena` WHERE `usr` = '".$udata2['nick']."'");
mysql_query("DELETE FROM `tmp_arena` WHERE `oponent` = '".$udata2['nick']."'");
mysql_query("DELETE FROM `arena` WHERE `oponent` = '".$udata2['nick']."' or `lider` = '".$udata2['nick']."'");
header('Location: ?arena&LinkGoUserEnd'); exit;
}
$req2 = mysql_query("SELECT * FROM `tmp_arena` WHERE `oponent` = '".$udata2['nick']."' LIMIT 1");
$ar2 = mysql_fetch_array($req2);
$req = mysql_query("SELECT * FROM `tmp_arena` WHERE `usr` = '".$udata2['nick']."' LIMIT 1");
$ar = mysql_fetch_array($req);
$chek = mysql_num_rows($req);
if($chek <= 0)
{
header('Location: ?arena');
}
if($ar['step'] == 'yes')
{
echo'Вы сделали ход<br />ожидайте хода противника<br /><br><a class="loc" href="?go_boy&'.rand(1000,9999).'"><img width="16" height="16" src="/images/icons/refresh.png" alt="*"/> Обновить</a><br />';
echo '</div>';
include_once 'inc/foot.php';
}
////////////////////////////////////////////////////////////////////// pac 1
if(isset($_GET['udar'])){
$req = mysql_query("SELECT * FROM `arena` WHERE `lider` = '".$udata2['nick']."' LIMIT 1");
$chek = mysql_fetch_array($req);
if($chek['oponent'] == 'not')
{
echo'Нет противника<br />';
echo'<a class="loc" href="?go_boy&'.rand(1000,9999).'"><img width="16" height="16" src="/images/icons/refresh.png" alt="*"/> Обновить</a><a class= "loc" href="?go_boy&exit"><img width="16" height="16" src="/images/icons/cross.png" alt="*"/> Отменить</a><br />';
echo '</div></div>'; include 'inc/foot.php'; exit;
}
$req = mysql_query("SELECT * FROM `tmp_arena` WHERE `usr` = '".$udata2['nick']."'");
$chek = mysql_num_rows($req);
if($chek <= 0)
{
header('Location: ?arena');
}
$req = mysql_query("SELECT * FROM `kolhoz_user` WHERE `nick` = '".$ar['oponent']."' LIMIT 1");
$op = mysql_fetch_array($req);
$attack = mysql_real_escape_string($_POST['a_kuda']);
$protect = mysql_real_escape_string($_POST['p_kuda']);
if($_POST['a_kuda'] == 'golova')
{
$ref=rand(0,2);
$uron = $ku['arena1']+$ref;
$msg = 'Игрок '.$udata2['nick'].' ударил вас в голову на '.$uron.' урона';
}
if($_POST['a_kuda'] == 'body')
{
$ref = rand(0,1);
$uron = $ku['arena1']+$ref;
$msg = 'Игрок '.$udata2['nick'].' ударил вас в живот на '.$uron.' урона';
}
if($_POST['a_kuda'] == 'nogi')
{
$ref = rand(0,1);
$uron = $ku['arena1']+$ref;
$msg = 'Игрок '.$udata2['nick'].' ударил вас в ноги на '.$uron.' урона';
}
if($uron > $op['arena2'])
{
echo 'Вы побeдили игрока '.$op['nick'];
echo '<br /><br><a class="loc" href="?arena">Вернутся на Арену</a><br />';
$win = $udata2['arena_win'] + 1;
$expt = rand(100,1000);
$exp = $ku['arena4']*$expt;
$expw = 1;
$ret = $ku['arena5']*$ku['arena4'];
mysql_query("UPDATE `kolhoz_user` SET `arena_win` = '".($ku['arena_win']+$expw)."', `rating` = '".($ku['rating']+$exp)."', `arena2` = '".$ref."' WHERE `nick` = '".$udata2['nick']."' LIMIT 1");
mysql_query("DELETE FROM `tmp_arena` WHERE `usr` = '".$udata2['nick']."'");
mysql_query("DELETE FROM `tmp_arena` WHERE `usr` = '".$op['nick']."'");
$re = 0;
mysql_query("UPDATE `kolhoz_user` SET `arena2` = '$re' WHERE `nick` = '".$op['nick']."' LIMIT 1");
mysql_query("DELETE FROM `arena` WHERE `oponent` = '".$udata2['nick']."' or `lider` = '".$udata2['nick']."'");
$_SESSION['rating']=$exp;
update_mc($expq);
include_once 'inc/foot.php';
exit;
}
if($ku['arena2'] <= 0)
{
echo 'Вы проиграли';
echo '<br /><a href="?arena">Продолжить</a><br />';
mysql_query("DELETE FROM `tmp_arena` WHERE `usr` = '".$udata2['nick']."'");
mysql_query("DELETE FROM `tmp_arena` WHERE `usr` = '".$op['nick']."'");
mysql_query("DELETE FROM `arena` WHERE `oponent` = '".$udata2['nick']."'");
echo '</div></div>'; include 'inc/foot.php'; exit;
}
$uron = $op['arena2'] - $uron;
if($uron <= 0)
{
$uron = $op['arena2'] - 0;
$msg = 'Игрок '.$udata2['nick'].' нанес вам 0 урона';
}
if($attack == $ar2['protect'])
{
$uron = $op['arena2'] -0;
$msg = 'Вы заблокировали удар';
}
$time = time()+30;
mysql_query("INSERT INTO `msg_arena` SET `usr` = '".$udata2['nick']."', `oponent` = '".$ar['oponent']."', `msg` = '$msg', `time` = '$time'");
mysql_query("UPDATE `tmp_arena` SET `step` = 'yes', `protect` = '$protect', `attack` = '$attack' WHERE `usr` = '".$udata2['nick']."' LIMIT 1");
$req = mysql_query("UPDATE `tmp_arena` SET `step` = 'not' WHERE `oponent` = '".$udata2['nick']."' LIMIT 1");
mysql_query("UPDATE `kolhoz_user` SET `arena2` = '$uron' WHERE `nick` = '".$ar['oponent']."' LIMIT 1");
if($req = true)
{
header('Location: ?go_boy');
}else{
echo 'Ошибка... Администратор извещен.';
}
}elseif(isset($_GET['exit'])){
if($_GET['go'] == 'lider')
{
mysql_query("DELETE FROM `tmp_arena` WHERE `usr` = '".$ku['nick']."'");
mysql_query("DELETE FROM `tmp_arena` WHERE `oponent` = '".$ku['nick']."'");
mysql_query("DELETE FROM `arena` WHERE `lider` = '".$ku['nick']."'");
header("Location: ?arena");
}
}else{
if($ku['arena2'] <= 0)
{
header('Location: ?go_boy&udar');
exit;
}
$req = mysql_query("SELECT * FROM `arena` WHERE `lider` = '".$udata2['nick']."' LIMIT 1");
$chek = mysql_fetch_array($req);
if($chek['oponent'] == 'not')
{
echo'Заявка создана. Ожидайте соперника<br /><br />';
echo'<a class="loc" href="?go_boy&'.rand(1000,9999).'"><img width="16" height="16" src="/images/icons/refresh.png" alt="o"> Обновить</a><a class="loc" href="?go_boy&exit&go=lider"><img alt="" width="16" height="16" src="http://kolhoz.mobi/images/icons/cross.png"> Отменить</a>';
include 'inc/foot.php'; exit;
}
$req = mysql_query("SELECT * FROM `kolhoz_user` WHERE `nick` = '".$ar['oponent']."' LIMIT 1");
$op = mysql_fetch_array($req);
//////////////ава//////////////
if (file_exists('images/avatars/'.$ku['oponent'].'.png'))
{
echo "<img width='35%' height='35%' src='images/avatars/$ku[oponent].png' alt='farm' style='border-radius: 6px;'/>";
}
echo "<br>";
//////////////////////////////////////
echo'Жизни противника '.$ar['oponent'].' <img width="16" height="16" src="http://kolhoz.mobi/images/icons/heart.png" alt="o"/> '.$op['arena2'].'<br />';
echo'Ваши жизни <img width="16" height="16" src="http://kolhoz.mobi/images/icons/heart.png" alt="o"/> '.$ku['arena2'];
echo '<li>Ваши способности: <span>
<span>
<img width="16" height="16" src="http://kolhoz.mobi/images/icons/sword.png" alt="Мощн" title="Мощн"/> <span class="title">'.$ku['arena1'].'</span>
</span><span>
<img width="16" height="16" src="http://kolhoz.mobi/images/icons/heart.png" alt="Жив" title="Жив"/> <span class="title">'.$ku['arena2'].' </span>
</span><span>
<img width="16" height="16" src="http://kolhoz.mobi/images/icons/shield.png" alt="Защита" title="Защита"/> <span class="title">'.$ku['arena3'].'</span>
</span>
</span></li><br>';
echo '<form action="?go_boy&udar" method="post">';
echo "Ударить:
<select name="a_kuda">
<option value="golova">В голову</option>
<option value="body">В живот</option>
<option value="nogi">В ноги</option>
</select><br/><br/>";
echo "Защита: 
<select name="p_kuda">
<option value="golova">Головы</option>
<option value="body">Живота</option>
<option value="nogi">Ног</option>
</select><br/><br>";
echo '<input class="button" type="submit" value="Ударить" /></form>';
$req = mysql_query("SELECT * FROM `msg_arena` WHERE `oponent` = '".$udata2['nick']."' ORDER BY `id` DESC LIMIT 10");
@$avto = mysql_num_rows($req);
while(@$msg = mysql_fetch_array($req)){
if(time() < $msg['time'])
{
echo $msg['msg'];
echo '<br />';
}
}
}
echo '</div>';
include_once 'inc/foot.php';
?>