Файл: ubiznes.mobi/inc/location/snow/index.php
Строк: 303
<?
$snow=mysql_fetch_assoc(mysql_query("SELECT * FROM `snow` WHERE `id` = '1'"));
if($snow['level']==0)$count=10000; elseif($snow['level']==1)$count=30000;elseif($snow['level']==2)$count=50000;elseif($snow['level']==3)$count=100000;
if($snow['count']>=$count){
mysql_query("UPDATE `snow` SET `level` = `level` + '1',`count` = `count` - '$count' WHERE `id` = '1'");
header("location:/?snow");exit;
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `snow_user` WHERE `id_user` = '$user[id]'"),0)==0){
mysql_query("INSERT INTO `snow_user` SET `id_user` = '$user[id]'"); header("Location:/?snow");exit;
}$me=mysql_fetch_assoc(mysql_query("SELECT * FROM `snow_user` WHERE `id_user` = '$user[id]' LIMIT 1"));
/*if(isset($_GET['user_present'])){
$count_pres=intval($me['count_all']/100);
if($count_pres==0)$count_pres=1;
echo'<div class="b-top"> <h2> <a href=/?snow> Новый Год </a> / Подарки под елкой</h2> </div>';
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `snow_user_present` WHERE `id_user` = '$user[id]'"),0)==0){
mysql_query("INSERT INTO `snow_user_present` SET `id_user` = '$user[id]', `count` = '$count_pres'"); header("location:/?snow&user_present");exit;
}$sup=mysql_fetch_assoc(mysql_query("SELECT * FROM `snow_user_present` WHERE `id_user` = '$user[id]' LIMIT 1")); $counts=5;
if($count_pres!=$sup['count']){
mysql_query("UPDATE `snow_user_present` SET `count` = '$count_pres' WHERE `id_user` = '$user[id]'"); header("location:/?snow&user_present");exit;
}
if(isset($_GET['open_prs']) && (($sup['count']-$sup['open'])>0)){
$rand=rand(1,50);
mysql_query("UPDATE `snow_user_present` SET `open` = `open` + '1' WHERE `id_user` = '$user[id]'");
mysql_query("INSERT INTO `snow_user_present_log` SET `count` = '$rand', `id_user` = '$user[id]', `time` = '$time'");
mysql_query("UPDATE `user` SET `baks` = `baks` + '$rand' WHERE `id` = '$user[id]'");
$_SESSION['baks']=$rand; header("location:/?snow&user_present");exit;
}
if(isset($_GET['open_prs2']) && ($counts-$sup['open2'])>0){
$rand=rand(1,100);
mysql_query("UPDATE `snow_user_present` SET `open2` = `open2` + '1' WHERE `id_user` = '$user[id]'");
mysql_query("INSERT INTO `snow_user_present_log` SET `count` = '$rand', `id_user` = '$user[id]', `time` = '$time'");
mysql_query("UPDATE `user` SET `baks` = `baks` + '$rand' WHERE `id` = '$user[id]'");
$_SESSION['baks']=$rand; header("location:/?snow&user_present");exit;
}
if(($sup['count']-$sup['open'])>0){
echo'<div class="pan-4">
<img width="48" height="48" src="https://pngicon.ru/file/uploads/1303507318_box2.png" class="portrait">
<div> <font color="violet"> Новогодний подарок </font> | Количество: <font color="yellow"> '.($sup['count']-$sup['open']).' </font> </div>
<div> '.img_ic(16,16,'style/str').' <a href="/?snow&user_present&open_prs">[Открыть подарок]</a> </div>
<div style="clear:both"></div>
</div>';
}
if(($counts-$sup['open2'])>0){
echo'<div class="pan-4">
<img width="48" height="48" src="http://iconizer.net/files/Stunning_Christmas_icons/orig/gift.png" class="portrait">
<div> <font color="violet"> Новогодний подарок №2</font> | Количество: <font color="yellow"> '.($counts-$sup['open2']).' </font> </div>
<div> '.img_ic(16,16,'style/str').' <a href="/?snow&user_present&open_prs2">[Открыть подарок]</a> </div>
<div style="clear:both"></div>
</div>';
}
if(($sup['count']-$sup['open'])<=0 && ($counts-$sup['open2'])<=0){
echo'<div class="pan-4"> Вы открыли все подарки :( </div>';
}
echo'<div class="b-top"> <h2> История открытия подарков</h2> </div>';
echo'<div class="pan-4">';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `snow_user_present_log` WHERE `id_user` = '$user[id]'"),0);
$pages=8;
if($k_post==0){echo'<div class="pan-4"> Вы еще не открывали подарки </div>';}
$k_page=k_page($k_post,$pages);
$page=page($k_page);
$start=$pages*$page-$pages;
$q=mysql_query("SELECT * FROM `snow_user_present_log` WHERE `id_user` = '$user[id]' ORDER BY `time` DESC LIMIT $start, $pages");
while($post=mysql_fetch_assoc($q)){
echo'<div> '.user_icon($post['id_user']).nc($post['id_user']).' + '.img_ic(16,16,'icons/baks').' <font color="yellow"> '.razd($post['count']).' </font>
<span style="float:right"><span class="small"> <font color="grey"> '.vremja($post['time']).'</font></span></span></div>';
}
echo'</div>';
if($k_page>1){ echo'<div class="pan-4">'; str("?snow&user_present&",$k_page,$page); echo'</div>';}
back("/?snow");
include_once'sys/foot.php';
}
if(isset($_GET['give_pres'])){
echo'<div class="b-top"> <h2> <a href=/?snow> Новый Год </a> / Взнос подарков </h2> </div>';
if(isset($_POST['gives'])){
$count=abs(intval($_POST['count']));
if($me['count']<$count){$err=1;err_game('У Вас не хватает '.img_ic(16,16,'icons/present').' <font color="yellow"> '.razd($count-$me['count']).'</font>');}
elseif($count<=0){$err=1; err_game('Минимум '.img_ic(16,16,'icons/present').' <font color="yellow">1</font> подарок для взноса');}
if(empty($err)){
mysql_query("UPDATE `snow_user` SET `count` = `count` - '$count',`count_all` = `count_all` + '$count' WHERE `id_user` = '$user[id]'");
mysql_query("UPDATE `snow` SET `count` = `count` + '$count' WHERE `id` = '1'");
heads(img_ic(16,16,'icons/present').' <font color="yellow"> '.razd($count).' шт.</font> подарков успешно внесены',"/?snow");
}
}
echo'<div class="pan-4"> У Вас: '.img_ic(16,16,'icons/present').' <font color="yellow"> '.razd($me['count']).' </font> подарков </br>
<form method="post">
Введите кол-во подарков:</br><input type="number" name="count"></br>
<input type="submit" name="gives" value="Внести"></form>
</div>';
echo'<div class="pan-4">
<font color="grey" size="2">
<font color="red">(*)</font> За каждые внесенные <font color="yellow">100 подарков</font> Вы получаете <font color="aqua">1 подарок к себе под елку</font></br>
<font color="red">(*)</font> Чем <font color="yellow">больше подарков</font> под елкой, тем <font color="violet">лучше призы</font>.</br>
<font color="red">(*)</font> Призы под елками можно получить только <font color="yellow">31 декабря</font></br>
</font>
</div>';
back("/?snow");
include_once'sys/foot.php';
<center> '.img_ic(16,16,'icons/present').' <a href=/?snow&give_pres>[Внести подарки]</a>'.img_ic(16,16,'icons/present').' </center>
</br><center> <a href=/?snow&user_present class="text-2"><img width="32" height="32" src="http://iconizer.net/files/Stunning_Christmas_icons/orig/gift.png"> [Открыть подарки] <img width="32" height="32" src="https://pngicon.ru/file/uploads/1303507318_box2.png"></a> </center></br>
}*/
$prog=$snow['count']/$count*100;
echo'<div class="b-top"> <h2> Новый Год </h2> </div>';
echo'<div class="pan-4">
<center> <img width="220" height="300" src="/images/snow/tree'.$snow['level'].'.png"> </center>
<div class="prog">
<table style="width:100%;">
<tbody>
<tr>
<td style="width:15%;">
<center>
<img src="/images/style/star_on.png" width="16" height="16">'.$snow['level'].'
</center>
</td>
<td style="width:70%;">
<div class="lvlPrgbr">
<div class="prgbr">
<div class="prg" style="width:'.$prog.'%;"></div>
</div>
</div>
</td>
<td style="width:15%;">
<center>
<img src="/images/style/star_on.png" width="16" height="16"> '.($snow['level']+1).'
</center>
</td>
</tr>
</tbody>
</table>
<center> '.img_ic(16,16,'icons/present').' Собрано: <font color="yellow"> '.razd($snow['count']).' </font> / <font color="violet">'.razd($count).'</font> '.img_ic(16,16,'icons/present').' </center>
</div>
</div>';
echo'<div class="pan-4"> У Вас: '.img_ic(16,16,'icons/present').' <font color="yellow"> '.razd($me['count']).' </font> подарков </div>';
echo'<div class="pan-4"> Подарков сдано: '.img_ic(16,16,'icons/present').' <font color="yellow"> '.razd($me['count_all']).' </font> подарков </div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `snow_user` WHERE `count_all` > '0'"),0);
echo'<div class="pan-4"> <h2> Рейтинг по взносу подарков </h2>';
$pages=5;
if($k_post==0){echo'<div class="pan-4"> Взносов подарков не было :( </div>';}
$k_page=k_page($k_post,$pages);
$page=page($k_page);
$start=$pages*$page-$pages;
$q=mysql_query("SELECT * FROM `snow_user` WHERE `count_all` > '0' ORDER BY `count_all` DESC LIMIT $start, $pages");
while($post=mysql_fetch_assoc($q)){
echo'<div> '.user_icon($post['id_user']).nc($post['id_user']).' - '.img_ic(16,16,'icons/present').' <font color="yellow"> '.razd($post['count_all']).' </font></div>';
}
echo'</div>';
if($k_page>1){ echo'<div class="pan-4">'; str("?snow&",$k_page,$page); echo'</div>';}
include_once'sys/foot.php';