<?php
require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
$page_title = 'Дуэли';
require_once('conf/head.php');
if ((isset($_SESSION['id'])) and (isset($_SESSION['nick'])))  {
  require_once('conf/top.php');
}
if ((!isset($_SESSION['id'])) and (!isset($_SESSION['nick'])))  {
header('Location: /index.php');
}
//<!--Переменные-->//
$id = abs(intval($_SESSION['id'])); //ID user
$nick = filter($_SESSION['nick']); //Nick User
//////////////////////////////////////
$user_q = "SELECT * FROM users WHERE id = $id LIMIT 1";
$user_r = mysqli_query($dbc, $user_q) or die('ERROR: 1');
$user = mysqli_fetch_array($user_r);
$lvl1 = $user['lvl'];
$hp1 = $user['hp'];
$bronya1 = $user['bronya'];
$mhp = $user['max_hp'];
$dmg11 = $user['yron_p'];
$dmg12 = $user['yron_w'];
$av1 = $user['avatar'];
$habar = $user['habar'];
$timearena = $user['timearena'];
if($lvl1 < 5){
echo '<br/><center><p class="name2">Дуэли</p></center>';
echo '<span class="red">Дуэли доступны с 5 ур</span>';
require_once('conf/navig.php');
require_once('conf/foot.php');
exit();
}
if((time()-$timearena) < 1800) {
$time=$timearena-time()+1800;
echo '<br/><center><p class="name2">Дуэли</p></center>
<center><img src="ing/Dark-Souls-II-Scholar-of-the-First-Sin-07-300x169.jpg" width="100%" ></img></center>';
echo '<p class="podmenu">Выбор противника:</p>';
echo '<span class="red">До следующего боя должно пройти:<b>
'.($time/60%60).' мин. '.($time%60).' сек.</span></b>';
require_once('conf/navig.php');
require_once('conf/foot.php');
exit();
}
echo '<br/><center><p class="name2">Дуэли</p><img width="100%"  src="ing/Dark-Souls-II-Scholar-of-the-First-Sin-07-300x169.jpg"></img></center>';
if(!empty($_GET['err'])) {?><div id="error">
   <?php if ($_GET['err']==1) {echo 'Выбранный вами противник, отдыхаете после прошлого боя!';}?>
   <?php if ($_GET['err']==2) {echo 'Нельзя нападать на администраторов';}?>
   <?php if ($_GET['err']==3) {echo 'Вы выбрали соперника с неподходящим уровнем!';}?>
   <?php if ($_GET['err']==4) {echo 'У вас не хватает серебра!';}?>
   </div><?php }
echo '<p class="but-list-light center"><center>Выбор противника:</center></p>';
echo '<div><a href="arena1.php?type=3"><img src="/ing/bg_players1_1.png" width="497" height="45"></a></div>';
echo '<div><a href="arena1.php?type=2"><img src="/ing/bg_players_12.png" width="497" height="45"></a></div>';
echo '<div><a href="arena1.php?type=1"><img src="/ing/bg_players_13.png" width="497" height="45"></a></div>';
 //LVL > LVL User
//////////////////////////////////////
if ((isset($_SESSION['id'])) and (isset($_SESSION['nick'])))  {
  require_once('conf/navig.php');
}
require_once('conf/foot.php');
?>
</body>
</html>