<?php
session_start();
define("PATH", $_SERVER['DOCUMENT_ROOT']);
include(PATH."/core/func.php");
include(PATH."/core/db.php");
include(PATH."/core/set.php");
include(PATH."/core/define.php");
include(PATH."/core/defineset.php");
db_connect();

//Сапер 
$month_top = getMonthTop();
$month_sum = getMonthSum();

if($month_top['qt'] != 0)
{
	for ($i=0; $i < 9; $i++) { 
		$user_info = getUserInfo($month_top[$i]['login']);
		setUserInfo($user_info['login'], "balance", $user_info['balance'] + getMonthSumm($month_top['qt'], $month_sum, $i+1));
	}
	
	db_query("UPDATE `".DBpref."users` SET `month_bonus` = 0");
}

db_close();
?>