<?php

require_once 'core/system.php';








$yh = 0;

$by = $dbc->query("SELECT * FROM `user_pets` WHERE `tour`>0  ORDER BY `tour` desc limit 10");







$gold = 370; //сколько даем золота

$leg = 105; //сколько даем осколков










while($de=$by->fetch_assoc()){


$gold  = $gold -20;
$leg  = $leg -5;



$yh++; 


$dbc->query("UPDATE `users` SET `gold`=`gold`+".$gold.",`leg`=`leg`+".$leg." WHERE `id`='".$de['id_user']."'"); 





$dbc->query("INSERT INTO `journal` SET `user_id`='".$de['id_user']."', `text`='Ваш питомец занял ".$yh." место в турнире. награда <img src=img/money/money.png>".$gold." <img src=img/new/leg.png>".$leg."',   `time`='".time()."'"); 




$dbc->query("UPDATE `users` SET `journal`=`journal`+1 WHERE `id`='".$de['id_user']."'"); 



 }




 
$dbc->query("UPDATE `user_pets` SET `tour`=0 "); 


 

