Файл: vitaliy_nosov/public_html/game/bonus.php
Строк: 25
<?php
$gold = $user['bonus'] * 10;
if(isset($_POST['get'])){
if($user['bonus_time'] > time()) $err ='Вы сегодня уже забирали свой бонус';
if(!isset($err)){
mysql_query("UPDATE `user` SET `gold` = '".($user['gold'] + $gold)."', `bonus_time` = '".(time() + 86000)."', `bonus` = '".($user['bonus'] + 1)."' WHERE `id` = '".$user['id']."'");
header('Location: /game/');
die();
}else{
header('Location: /game/');
die();
}
}
if($user['bonus_time'] < time()){
if($user['bonus'] = 0){
mysql_query("UPDATE `user` SET `bonus` = 1 WHERE `id` = '".$user['id']."'");
}
if($user['bonus'] == 9){
mysql_query("UPDATE `user` SET `bonus` = 1 WHERE `id` = '".$user['id']."'");
}
echo ' <div class="block center">Ваш бонус '.$gold.' <img src="/style/gold.png"></div>
<form class="block center" method="post" action=""><span class="button_on"><input class="button_on" name="get" type="submit" value="Забрать"></span></form>';
}
?>