<?php
include ('inc/base.php');
include ('inc/functions.php');
include ('inc/user.php');
$title = 'Ежедневный подарок';
include ('inc/header.php');
if(!$user) {
header('location: /');
exit();
}
if($user['gift'] > time()) {
echo '<div class="main center">Вы уже получали ежедневный подарок недавно!</div>';
include ('inc/footer.php');
exit();
}
if($user['rating'] < '100') {
$my_cash = '100';
}else{
$my_cash = round(100 + $user['rating'] / 5);
}
if($user['access'] == '0') {
$cash = $my_cash;
}
if($user['access'] == '1' and $user['banned'] == '0') {
$cash = 5000+$my_cash;
}
if($user['access'] == '1' and $user['banned'] >= '1') {
$cash = $my_cash;
}
if(isset($_GET['take'])) {
mysql_query("update `accounts` set `cash` = `cash` + '".$cash."', `gift` = '".(time() + 86400)."' where `id` = '".$user['id']."'");
echo '<div class="main center">Вы забрали ежедневный подарок!</div>';
echo '<a href="?" class="link center">Продолжить</a>';
include ('inc/footer.php');
exit();
}
echo '<div class="main center">Сегодня ты получаешь: '.$cash.' <img src="/style/src/cash.png" height="14"></div><a href="?take" class="link center">Забрать</a><div class="main"><small>Чем выше твой рейтинг - тем больше награда!</small></div>';
include ('inc/footer.php');
?>