<?php
include './system/func.php';
include './system/header.php';
$title = 'Целитильница';
echo div('header');

echo "<center><img src='http://btvar.ru/images/town/wizard.jpg' width=70%><br><font size=4px>Я могу востановить тебе жизнь за 200 <img src='/images/icons/gold.png'></font><br><div class='btn_grey'><span class='cb_end'><span class='cb_ttl'> <a href='?act=go'>Востановить</div></a></span> </span></div></center>";
if (isset($_GET['act']) && $_GET['act'] == 'go') {
    if ($user['gold'] >= 200 AND $user['energy'] < 5000) {
        $_SESSION['msg'] = 'Жизнь востановлена';
        echo "</div>";

        if (mysql_result(mysql_query("SELECT COUNT(*) FROM `demons_players` WHERE `id_user` = '" . $user['id'] . "'"), 0) == true) {
            mysql_query("UPDATE `demons_players` SET `health` = '" . $user['max_health'] . "' WHERE `id_user` = '" . $user['id'] . "' LIMIT 1");

        }

        mysql_query("UPDATE `users` SET `health` = '" . $user['max_health'] . "', `energy` = '" . $user['max_energy'] . "', `gold` = `gold` - '200' WHERE `id` = '" . $user['id'] . "' LIMIT 1");
        header('location:?');
        exit();
    }
}
//if($user[energy] >4998) {
//echo "<center><font size=2px>Вы не нуждаетесь востановлению!</font></center>";
//}
include './system/footer.php';
?>
