Файл: public_html/day.php
Строк: 157
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user or $user['level']<='2') {
header('location: /');
exit;
}
$title = 'Ежедневная награда';
include './system/h.php';
$gift = mysql_fetch_assoc(mysql_query("SELECT * FROM `user_podarok` WHERE `user_id` = '$user[id]' order by `last_auth` desc limit 1"));
$time = $gift['last_auth'] + 86400;
$h = (($gift['last_auth'] + 86400) / 60);
$crystal = $user['day'] * 50 + 500;
$rubin = $user['day'] * 2;
$jetton = $user['day'] * 2 + 3;
$crystal1 = ($user['day'] + 1) * 50 + 500;
$rubin1 = ($user['day'] + 1) * 2;
$res_12 = (1+1+1);
$now = time();
if(isset($_GET['take'])){
if ($time < $now) {
mysql_query('UPDATE `users` SET `g` = `g` + '.(($user['day'] * 50) + 500).' WHERE `id` = "'.$user['id'].'"');
mysql_query("UPDATE `users` SET `day` = `day` + '1' WHERE `id` = '$user[id]'");
if(mysql_result(mysql_query("SELECT count(user_id) from `user_podarok` where `user_id` = '".$user['id']."'"),0) == 0){
mysql_query("INSERT INTO `user_podarok` SET `last_auth` = '$now', `stage` = '1', `user_id` = '$user[id]'");
}else{
mysql_query("UPDATE `user_podarok` SET `last_auth` = '$now', `stage` = `stage` + '1' WHERE `user_id` = '$user[id]'");
}
} else {
}
}
if ($time < $now) {
$hour_s = ceil(($time - $now) / 3600);
} else {
$hour_t = ceil(($time - $now) / 3600);
$min = ceil(($time - $now) / 60);
$h = ceil((($time - $now) / 60) / 60);
if ($hour_t == 1 or $hour_t == 21) {
$hour = 'час';
} elseif ($hour_t >= 2 and $hour_t <= 4 or $hour_t >= 22 and $hour_t <= 24) {
$hour = 'часа';
} elseif ($hour_t >= 5 and $hour_t <= 20) {
$hour = 'часов';
}
}
?>
</div></div></div></div></div>
<div class='one_by_one chh'>
<div class="header-title"><?if($user['day'] > 1) {?>1 день √<? } ?><?if($user['day'] <= 1) {?>1 день ×<? } ?></div>
<tbody>
<tr>
<td style="width: 14%; text-align: center; vertical-align: middle; background-color: rgb(9, 26, 43);">
<br><span style="color: rgb(255, 255, 0);"><img src='/images/icon/gold.png'>200 золота</span></td>
</tr>
</tbody>
</table>
<hr>
<div class="header-title"><?if($user['day'] > 2) {?>2 день √<? } ?><?if($user['day'] <= 2) {?>2 день ×<? } ?></div>
<tbody>
<tr>
<td style="width: 14%; text-align: center; vertical-align: middle; background-color: rgb(9, 26, 43);">
<br><span style="color: rgb(255, 255, 0);"><img style="width: 15px; height: 15px;" src='/images/icon/gold.png'>500 золота</span></td>
</tr>
</tbody>
</table>
<hr>
<div class="header-title"><?if($user['day'] > 3) {?>3 день √<? } ?><?if($user['day'] <= 3) {?>3 день ×<? } ?></div>
<tbody>
<tr>
<td style="width: 14%; text-align: center; vertical-align: middle; background-color: rgb(9, 26, 43);">
<br><span style="color: rgb(255, 255, 0);"><img src='/images/icon/gold.png'>1000 золота</span></td>
</tr>
</tbody>
</table>
<hr>
<div class="header-title"><?if($user['day'] > 4) {?>4 день √<? } ?><?if($user['day'] <= 4) {?>4 день ×<? } ?></div>
<tbody>
<tr>
<td style="width: 14%; text-align: center; vertical-align: middle; background-color: rgb(9, 26, 43);">
<br><span style="color: rgb(255, 255, 0);"><img src='/images/icon/gold.png'>2'000 золота</span></td>
</tr>
</tbody>
</table>
<hr>
<div class="header-title"><?if($user['day'] > 5) {?>5 день √<? } ?><?if($user['day'] <= 5) {?>5 день ×<? } ?></div>
<tbody>
<tr>
<td style="width: 14%; text-align: center; vertical-align: middle; background-color: rgb(9, 26, 43);">
<br><span style="color: rgb(255, 255, 0);"><img style="width: 15px; height: 15px;" src='/images/icon/gold.png'>5000 золота</span></td>
</tr>
</tbody>
</table><hr>
<div class="header-title"><?if($user['day'] > 6) {?>6 день √<? } ?><?if($user['day'] <= 6) {?>6 день ×<? } ?></div>
<tbody>
<tr>
<td style="width: 14%; text-align: center; vertical-align: middle; background-color: rgb(9, 26, 43);">
<br><span style="color: rgb(255, 255, 0);"><img src='/images/icon/gold.png'>10000 золота</span></td>
</tr>
</tbody>
</table>
<hr>
<div class="header-title"><?if($user['day'] > 7) {?>7 день √<? } ?><?if($user['day'] <= 7) {?>7 день ×<? } ?></div>
<tbody>
<tr>
<td style="width: 14%; text-align: center; vertical-align: middle; background-color: rgb(9, 26, 43);">
<br><span style="color: rgb(255, 255, 0);"><img src="/images/icon/gold.png"> 15000 золота</span></td>
</tr>
</tbody>
</table>
<center>
<?if($user['day']==1) {?>
<? if ($time < $now) { ?><a class='button' href='?day1'>Получить награду</a><? } ?>
<? if ($time > $now) { ?><a class='button-red backgreen ib '>Награда уже получена</a><br>До следующей награды: <?=$h?> час(а) <? } ?><?}?>
<?if($user['day']==2) {?>
<? if ($time < $now) { ?><a class='button' href='?day2'>Получить награду</a><? } ?>
<? if ($time > $now) { ?><a class='button-red backgreen ib '>Награда уже получена</a><br>До следующей награды: <?=$h?> час(а) <? } ?><?}?>
<?if($user['day']==3) {?>
<? if ($time < $now) { ?><a class='button' href='?day3'>Получить награду</a><? } ?>
<? if ($time > $now) { ?><a class='button-red backgreen ib '>Награда уже получена</a><br>До следующей награды: <?=$h?> час(а) <? } ?><?}?>
<?if($user['day']==4) {?>
<? if ($time < $now) { ?><a class='button' href='?day4'>Получить награду</a><? } ?>
<? if ($time > $now) { ?><a class='button-red backgreen ib '>Награда уже получена</a><br>До следующей награды: <?=$h?> час(а) <? } ?><?}?>
<?if($user['day']==5) {?>
<? if ($time < $now) { ?><a class='button' href='?day5'>Получить награду</a><? } ?>
<? if ($time > $now) { ?><a class='button-red backgreen ib '>Награда уже получена</a><br>До следующей награды: <?=$h?> час(а) <? } ?><?}?>
<?if($user['day']==6) {?>
<? if ($time < $now) { ?><a class='button' href='?day6'>Получить награду</a><? } ?>
<? if ($time > $now) { ?><a class='button-red backgreen ib '>Награда уже получена</a><br>До следующей награды: <?=$h?> час(а) <? } ?><?}?>
<?if($user['day']==7) {?>
<? if ($time < $now) { ?><a class='button' href='?day7'>Получить награду</a><? } ?>
<? if ($time > $now) { ?><a class='button-red backgreen ib '>Награда уже получена</a><br>До следующей награды: <?=$h?> час(а) <? } ?><?}?>
</div></div>
<?if (isset($_GET['day1']) && $user['day']==1){
if ($time < $now) {
mysql_query("UPDATE `users` SET `g` = `g` + '100' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `day` = '2' WHERE `id` = '$user[id]'");
if(mysql_result(mysql_query("SELECT count(user_id) from `user_podarok` where `user_id` = '".$user['id']."'"),0) == 0){
mysql_query("INSERT INTO `user_podarok` SET `last_auth` = '$now', `stage` = '1', `user_id` = '$user[id]'");
}else{
mysql_query("UPDATE `user_podarok` SET `last_auth` = '$now', `stage` = `stage` + '1' WHERE `user_id` = '$user[id]'");
}
}
header('Location: /day.php/');
}?>
<?if (isset($_GET['day2']) && $user['day']==2){
if ($time < $now) {
mysql_query("UPDATE `users` SET `g` = `g` + '500' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `day` = '3' WHERE `id` = '$user[id]'");
if(mysql_result(mysql_query("SELECT count(user_id) from `user_podarok` where `user_id` = '".$user['id']."'"),0) == 0){
mysql_query("INSERT INTO `user_podarok` SET `last_auth` = '$now', `stage` = '1', `user_id` = '$user[id]'");
}else{
mysql_query("UPDATE `user_podarok` SET `last_auth` = '$now', `stage` = `stage` + '1' WHERE `user_id` = '$user[id]'");
}
} header('Location: /day.php/');
}?>
<?if (isset($_GET['day3']) && $user['day']==3){
if ($time < $now) {
mysql_query("UPDATE `users` SET `g` = `g` + '1000' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `day` = '4' WHERE `id` = '$user[id]'");
if(mysql_result(mysql_query("SELECT count(user_id) from `user_podarok` where `user_id` = '".$user['id']."'"),0) == 0){
mysql_query("INSERT INTO `user_podarok` SET `last_auth` = '$now', `stage` = '1', `user_id` = '$user[id]'");
}else{
mysql_query("UPDATE `user_podarok` SET `last_auth` = '$now', `stage` = `stage` + '1' WHERE `user_id` = '$user[id]'");
}
} header('Location: /day.php/');
}?>
<?if (isset($_GET['day4']) && $user['day']==4){
if ($time < $now) {
mysql_query("UPDATE `users` SET `g` = `g` + '2000' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `day` = '5' WHERE `id` = '$user[id]'");
if(mysql_result(mysql_query("SELECT count(user_id) from `user_podarok` where `user_id` = '".$user['id']."'"),0) == 0){
mysql_query("INSERT INTO `user_podarok` SET `last_auth` = '$now', `stage` = '1', `user_id` = '$user[id]'");
}else{
mysql_query("UPDATE `user_podarok` SET `last_auth` = '$now', `stage` = `stage` + '1' WHERE `user_id` = '$user[id]'");
}
} header('Location: /day.php/');
}?>
<?if (isset($_GET['day5']) && $user['day']==5){
if ($time < $now) {
mysql_query("UPDATE `users` SET `g` = `g` + '5000' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `day` = '6' WHERE `id` = '$user[id]'");
if(mysql_result(mysql_query("SELECT count(user_id) from `user_podarok` where `user_id` = '".$user['id']."'"),0) == 0){
mysql_query("INSERT INTO `user_podarok` SET `last_auth` = '$now', `stage` = '1', `user_id` = '$user[id]'");
}else{
mysql_query("UPDATE `user_podarok` SET `last_auth` = '$now', `stage` = `stage` + '1' WHERE `user_id` = '$user[id]'");
}
} header('Location: /day.php/');
}?>
<?if (isset($_GET['day6']) && $user['day']==6){
if ($time < $now) {
mysql_query("UPDATE `users` SET `g` = `g` + '10000' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `day` = '7' WHERE `id` = '$user[id]'");
if(mysql_result(mysql_query("SELECT count(user_id) from `user_podarok` where `user_id` = '".$user['id']."'"),0) == 0){
mysql_query("INSERT INTO `user_podarok` SET `last_auth` = '$now', `stage` = '1', `user_id` = '$user[id]'");
}else{
mysql_query("UPDATE `user_podarok` SET `last_auth` = '$now', `stage` = `stage` + '1' WHERE `user_id` = '$user[id]'");
}
} header('Location: /day.php/');
}?>
<?if (isset($_GET['day7']) && $user['day']==7){
if ($time < $now) {
mysql_query("UPDATE `users` SET `g` = `g` + 15000 WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `day` = '1' WHERE `id` = '$user[id]'");
if(mysql_result(mysql_query("SELECT count(user_id) from `user_podarok` where `user_id` = '".$user['id']."'"),0) == 0){
mysql_query("INSERT INTO `user_podarok` SET `last_auth` = '$now', `stage` = '1', `user_id` = '$user[id]'");
}else{
mysql_query("UPDATE `user_podarok` SET `last_auth` = '$now', `stage` = `stage` + '1' WHERE `user_id` = '$user[id]'");
}
} header('Location: /day.php/');
}?>
<?
include_once 'system/f.php';
?>