<?php
require_once ('../system/func.php');
$title = 'Городской бонус';
require_once ('../system/header.php');
if(isset($user['id']))
{
if(isset($_GET['force']) and $effect_1['on'] == 0)
{
if($user['gold'] >= 25)
{
if(!$effect_1)
{
mysql_query('INSERT INTO `effects` SET `sys_name` = "Приток силы", `id_user` = "'.$myID.'", `last` = "'.(time()+60*60*24).'", `on` = "1"');
mysql_query('UPDATE `users` SET `str` = "'.($user['str']+200).'", `gold` = "'.($user['gold']-25).'" WHERE `id` = "'.$myID.'"');
}
else
{
mysql_query('UPDATE `effects` SET `sys_name` = "Приток силы", `on` = "1", `last` = "'.(time()+60*60*24).'" WHERE `id` = "'.$effect_1['id'].'"');
mysql_query('UPDATE `users` SET `str` = "'.($user['str']+200).'", `gold` = "'.($user['gold']-25).'" WHERE `id` = "'.$myID.'"');
}
$_SESSION['msg'] = "Приток силы активирован";
header("Location: /effects");
exit();
}else{
$_SESSION['msg'] = "Не хватает ".(25-$user['gold'])." золота";
header("Location: /effects");
exit();
}
}
?>
<div class="mess_blue">Городской бонус</div>
<div class="auth_logo"></div>
<div class="blt blue"><b>Приток силы:</b> + <span class="minor">200</span>
<img src="/style/style/strength.png" width="12px" alt="*" /> на  
<img src="/style/style/time.png" width="12px" alt="*" /> <span class="green">24 часа</span> за 
<img src='/style/style/gold.png' width='12px'alt='*' /> <span class="money">25</span></div>
<?
if($effect_1['on'] == 0)
{
?>
<a href="?force" class="btn" title="Активировать">
<img src="/style/style/gold.png" width="12px" alt="*" /> <span class="money">Активировать</span></a>
<?
}
else
{
echo "<div class='blt blue'>
<img src='/style/style/time.png' width='12px'alt='*' /> <span class='minor'>Осталось:</span> 
<span class='green'>".tl($effect_1['last']-time())."</span></div>";
}
if(isset($_GET['experience']) and $effect_2['on'] == 0)
{
if($user['gold'] >= 25)
{
if(!$effect_2)
{
mysql_query('INSERT INTO `effects` SET `sys_name` = "Приток опыта", `id_user` = "'.$myID.'", `last` = "'.(time()+60*60*24).'", `on` = "1"');
mysql_query('UPDATE `users` SET `gold` = "'.($user['gold']-25).'" WHERE `id` = "'.$myID.'"');
}
else
{
mysql_query('UPDATE `effects` SET `sys_name` = "Приток опыта", `on` = "1", `last` = "'.(time()+60*60*24).'" WHERE `id` = "'.$effect_2['id'].'"');
mysql_query('UPDATE `users` SET `gold` = "'.($user['gold']-25).'" WHERE `id` = "'.$myID.'"');
}
$_SESSION['msg'] = "Приток опыта активирован";
header("Location: /effects");
exit();
}else{
$_SESSION['msg'] = "Не хватает ".(25-$user['gold'])." золота";
header("Location: /effects");
exit();
}
}
?>
<div class="blt blue"><b>Приток опыта:</b> + <span class="minor">25%</span>
<img src="/style/style/exp.png" width="12px" alt="*" /> на  
<img src="/style/style/time.png" width="12px" alt="*" /> <span class="green">24 часа</span> за 
<img src='/style/style/gold.png' width='12px'alt='*' /> <span class="money">25</span></div>
<?
if($effect_2['on'] == 0)
{
?>
<a href="?experience" class="btn" title="Активировать">
<img src="/style/style/gold.png" width="12px" alt="*" /> <span class="money">Активировать</span></a>
<?
}
else
{
echo "<div class='blt blue'>
<img src='/style/style/time.png' width='12px'alt='*' /> <span class='minor'>Осталось:</span> 
<span class='green'>".tl($effect_2['last']-time())."</span></div>";
}
if(isset($_GET['survival']) and $effect_3['on'] == 0)
{
if($user['gold'] >= 50)
{
if(!$effect_3)
{
mysql_query('INSERT INTO `effects` SET `sys_name` = "Эффект выживания", `id_user` = "'.$myID.'", `last` = "'.(time()+60*60*24).'", `on` = "1"');
mysql_query('UPDATE `users` SET `def` = "'.($user['def']+200).'", `max_health` = "'.($user['max_health']+200).'", `gold` = "'.($user['gold']-50).'" WHERE `id` = "'.$myID.'"');
}
else
{
mysql_query('UPDATE `effects` SET `sys_name` = "Эффект выживания", `on` = "1", `last` = "'.(time()+60*60*24).'" WHERE `id` = "'.$effect_3['id'].'"');
mysql_query('UPDATE `users` SET `def` = "'.($user['def']+200).'", `max_health` = "'.($user['max_health']+200).'", `gold` = "'.($user['gold']-50).'" WHERE `id` = "'.$myID.'"');
}
$_SESSION['msg'] = "Бонус выживания активирован";
header("Location: /effects");
exit();
}
else
{
$_SESSION['msg'] = "Не хватает  ".(50-$user['gold'])." золота";
header("Location: /effects");
exit();
}
}
?>
<div class="blt blue"><b>Бонус выживания:</b> + <span class="minor">200</span>
<img src="/style/style/health.png" width="12px" alt="*" /> 
<img src="/style/style/armor.png" width="12px" alt="*" /> на  
<img src="/style/style/time.png" width="12px" alt="*" /> <span class="green">24 часа</span> за 
<img src='/style/style/gold.png' width='12px'alt='*' /> <span class="money">50</span></div>
<?
if($effect_3['on'] == 0)
{
?>
<a href="?survival" class="btn" title="Активировать">
<img src="/style/style/gold.png" width="12px" alt="*" /> <span class="money">Активировать</span></a>
<?
}
else
{
echo "<div class='blt blue'>
<img src='/style/style/time.png' width='12px'alt='*' /> <span class='minor'>Осталось:</span> 
<span class='green'>".tl($effect_3['last']-time())."</span></div>";
}








if(isset($_GET['cheerfulness']) and $effect_4['on'] == 0)
{
if($user['gold'] >= 75)
{
if(!$effect_4)
{
mysql_query('INSERT INTO `effects` SET `sys_name` = "Скорая бодрость", `id_user` = "'.$myID.'", `last` = "'.(time()+60*60*10).'", `on` = "1"');
mysql_query('UPDATE `users` SET `gold` = "'.($user['gold']-75).'" WHERE `id` = "'.$myID.'"');
}
else
{
mysql_query('UPDATE `effects` SET `sys_name` = "Скорая бодрость", `on` = "1", `last` = "'.(time()+60*60*10).'" WHERE `id` = "'.$effect_4['id'].'"');
mysql_query('UPDATE `users` SET `gold` = "'.($user['gold']-75).'" WHERE `id` = "'.$myID.'"');
}
$_SESSION['msg'] = "Скорая бодрость активирован";
header("Location: /effects");
exit();
}
else
{
$_SESSION['msg'] = "Не хватает  ".(75-$user['gold'])." золота";
header("Location: /effects");
exit();
}
}







?>
<div class="blt blue"><b>Скорая бодрость:</b> + <span class="minor">50%</span>
<img src="/style/style/regen.png" width="12px" alt="*" /> на  
<img src="/style/style/time.png" width="12px" alt="*" /> <span class="green">24 часа</span> за 
<img src='/style/style/gold.png' width='12px'alt='*' /> <span class="money">70</span></div>
<?
if($effect_4['on'] == 0)
{
?>
<a href="?cheerfulness" class="btn" title="Активировать">
<img src="/style/style/gold.png" width="12px" alt="*" /> <span class="money">Активировать</span></a>
<?
}
else
{
echo "<div class='blt blue'>
<img src='/style/style/time.png' width='12px'alt='*' /> <span class='minor'>Осталось:</span> 
<span class='green'>".tl($effect_4['last']-time())."</span></div>";
}
?>
<div class='btn'><img src="/style/style/level.png" width="12px" alt="*" /> 
<span class='info'>Бонусы - это усиления персонажа которые действуют определенное время</span>
</div>
<?
}
else
{
header('Location: /start');
}
require_once ('../system/footer.php');
?>