<?php

require_once 'core/system.php';







$final= $dbc->query("SELECT * FROM `dop` ORDER BY `koron` DESC LIMIT 1")->fetch_assoc();  


$es= $dbc->query("SELECT * FROM `users` WHERE `id`  ='".$final['user']."'")->fetch_assoc();  


$bonus=$dbc->query("SELECT * FROM `baza_bonus` where `sunduk`= 1 ORDER BY RAND() LIMIT 1 ")->fetch_assoc();   


$bylol = ("INSERT INTO `bag_bonus` (user_id,nik,tip,img,dop,lite,time) values('".$es['id']."','".$bonus['nik']."','".$bonus['tip']."','".$bonus['img']."','".$bonus['dop']."','".$bonus['lite']."','".$bonus['time']."')"); 




$dbc->query($bylol);

 
$tebe='Награда от Хранителей Лесов <span
class='.$bonus['lite'].'>




'.$bonus['nik'].'</span>';
$neys = $final['user'];



$maybe='Хранители Леса Преподносят<span


class='.$bonus['lite'].'>




'.$bonus['nik'].'</span> для <img src="img/class/'.$es['storona'].'/'.$es['pers'].'/pers.png" width="14" height="14" alt="*"><b><a href="pers.php?ank='.$es['id'].'"<font color=green> '.$es['login'].'</font>';

$neys = $final['user'];






$dbc->query("INSERT INTO `journal` SET `user_id`='".$neys."', `text`='".$tebe."',




    `time`='".time()."'");
$dbc->query("UPDATE `users` SET `journal`=`journal`+1 WHERE `id`='".$neys."'"); 











$dbc->query("INSERT INTO `chat` SET
        `user_id`=1,
        `text`='".$maybe."',
        `time`='".time()."'");







$dbc->query("UPDATE `users` SET `ch`=1 WHERE `ch`=0 and `id`!='".$user['id']."'"); 



$dbc->query("UPDATE `dop` SET `koron`=0 "); 

















