Размер файла: 1.99Kb
<?php
require_once 'core/system.php';
$header = 'Ежедневный бонус';
require_once 'core/head.php';
$t = time() - 86400;
$timepod = $tm + 86400;
if($user['bonus'] < $t){
mysql_query("UPDATE `user` SET `pod` = '0' WHERE `id` = '".$user['id']."'");
mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Ежедневный бонус', `time` = '".$tm."', `kol`='50', `kto`='+'");
mysql_query("UPDATE `user` SET `gold`=`gold`+'50',`pod` = '1',`bonus` = '".$timepod."' WHERE`id`='".$user['id']."'");
$_SESSION['light'] = "<font color='orange'>Ежедневный бонус</font></br> <span class='blue'>Награда: <img src='/images/icon/silver.png' alt=''/>50</span> ";
header('Location: /');
} elseif($user['bonus'] <= $tm){
if($user['pod'] == 0){
$pod = 1;
$gold = 100;
$icon = 'gold';
$kolvo = 1;
}
if($user['pod'] == 1){
$pod = 2;
$gold = 300;
$icon = 'gold';
$kolvo = 3;
}
if($user['pod'] == 2){
$pod = 3;
$gold = 700;
$icon = 'gold';
$kolvo = 7;
}
if($user['pod'] == 3){
$pod = 4;
$gold = 1500;
$icon = 'gold';
$kolvo = 15;
}
if($user['pod'] == 4 || $user['pod'] > 5){
$pod = 0;
$gold = 50;
$icon = 'silver';
$kolvo = 50;
}
$rest = mysql_result(mysql_query("SELECT COUNT(*) FROM `logi` WHERE `user_id` = '".$user['id']."' and `text` = 'Ежедневный бонус'"),0);
mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Ежедневный бонус', `time` = '".$tm."', `kol`='".$gold."', `kto`='+'");
mysql_query("UPDATE `user` SET `gold`=`gold`+'".$gold."',`pod` = '".$pod."',`bonus` = '".$timepod."' WHERE`id`='".$user['id']."'");
$_SESSION['light'] = "<font color='orange'>Вы получили ежедневный бонус!</font></br> <span class='blue'>Награда: <img src='/images/icon/$icon.png' alt=''/>".$kolvo."</span> ";
header('Location: /');
} else {
header('Location: /');
$_SESSION['err'] = 'Бонус уже получен';
exit();
}
include_once 'core/foot.php';
?>