

<?php 

include 'core/system.php';


head('Свитки');
reg(); 

$sql = $dbc->query("SELECT * FROM `bag_bonus` WHERE `user_id`='".$user['id']."'"); 



$total = $dbc->query("SELECT `id` FROM `bag_bonus` where `user_id` ='".$user['id']."'"); $total =$total->num_rows; 





if($total==0){
echo '<div class="main"><div class="block_zero center">У вас нет свитков в рюкзаке</div></div>';

foot();
exit;
} 


if(isset($_GET['scroll']) and !empty($_GET['ids'])){ 


$scroll  = int($_GET['ids']);


$you = $dbc->query("SELECT * FROM `bag_bonus` WHERE `id`='".$scroll."' AND `user_id`='".$user['id']."' LIMIT 1")->fetch_assoc();

if(!$you){
        header("Location: bag");
        exit;
        } 



if($you['tip']==2){ 




$until = $you['time'] + TIME;



$dbc->query("update `bonus` set `les_time` = ".$until." ,`les`  = 1 where `user` = '".$user['id']."'"); 




$dbc->query("delete from `bag_bonus` where `id`='".$you['id']."'"); 




$_SESSION['message'] = ''.$you[nik].'  Активирован'; 

}


if($you['tip']==4){ 




$until = $you['time'] + TIME;



$dbc->query("update `bonus` set `kris_time` = ".$until." ,`kris`  = 1 where `user` = '".$user['id']."'"); 




$dbc->query("delete from `bag_bonus` where `id`='".$you['id']."'"); 




$_SESSION['message'] = ''.$you[nik].'  Активирован'; 

} 


header('location:bag_scroll.php');exit;} 


while($row = $sql->fetch_assoc()){ 
?><div class="sblue-panel"><div class="panel-inner-3"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="37" style="vertical-align: top;"><img width="32"height="32" src="img/scroll/<?=$row['img']?>.png" alt="."border="0" >






</td><td><div><a href="/info_scroll.php?ids=<?=$row['tip']?>" class="<?=$row['lite']?>"><center><?=$row['nik']?></a></center></div><span class="nowrap"></span> <span class="nowrap"></span><span class="clearer"></span></td><td width="60"><a href="/bag_scroll.php?ids=<?=$row['id']?><??>&amp;scroll" class="gr-btn center"><span>Использовать</span></a></td></td></tr></table></div></div><?






}









foot(); 
