Файл: public_html/modules/campaign/result.php
Строк: 59
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include_once ($root.'/core/base.php');
falseauth();
$header = "Поход";
include_once ($root.'/core/head.php');
$issetCampaign = $db->query("SELECT * FROM `campaign_battle` WHERE `user` = '".$u['id']."'");
if($issetCampaign->num_rows == 0) redirect('/trip');
$iC = $issetCampaign->fetch_object();
if($iC->status == 'battle') redirect('/trip/battle');
if($iC->status == 'found') redirect('/trip/found');
$types = ['Орка', 'Гоблина', 'Эльфа', 'Гнома'];
if(isset($_GET['result-win']))
{
if($iC->status != 'result-win') redirect('/trip');
$exp = round($iC->mob_attack/3);
$silver = round($iC->mob_attack/2);
updateUserStats($u['id'],$exp,$silver,0);
$db->query("UPDATE `campaign_battle` SET `status` = 'end' WHERE `id` = '".$iC->id."'");
$_SESSION['result'] = 'Награда: <img src="/images/ic-experience-flat.png" width="20" height="20"> '.$exp.' и <img src="/images/silver.png" width="20" height="20"> '.$silver.'';
redirect('/trip/result');
}
if(!empty($_SESSION['result']))
{
echo '<div class="b"><center>
<center><img src="/images/campaign/win.png" width="100%"></center>
'.$_SESSION['result'].'</center></div>';
$_SESSION['result'] = null;
}
if(isset($_GET['end']))
{
$db->query("DELETE FROM `campaign_battle` WHERE `id` = '".$iC->id."'");
redirect('/trip');
}
if($iC->status == 'result-win')
{
echo '<div class="b">
<center>
<big><b><font color = "lime">Вы убили '.$types[$iC->type].'</font></b></big><br><br>
<center><img src="/images/campaign/mob-'.$iC->type.'.png" width="50%"></center>
</br>
<a href="?result-win"><input type="submit" value="Получить награду"></a>
</center>
</div>';
}
if($iC->status == 'result-lose')
{
echo '<div class="b">
<center>
Вы проиграли<br>
<center><img src="/images/campaign/notwin.png" width="100%"></center>
<br>
<a href="?end"><input type="submit" value="Вернуться в поход"></a>
</center>
</div>';
}
if($iC->status == 'end')
{
echo '<div class="b">
<center>
<a href="?end"><input type="submit" value="Вернуться в поход"></a>
</center>
</div>';
}
include_once ($root.'/core/foot.php');