<?php
/**
 * Created by PhpStorm.
 * Author: Serezha Kalitin
 * Date: 16.03.2019
 * Time: 11:10
 * Telegram: https://t.me/Serezhaua
 * Instagram: https://instagram.com/serezha.kalitin/
 */

require (CORE."head.php"); #Шапка


$q = DB::$pdo->query("SELECT rait_us,rait,id FROM `users` WHERE `rait_us` > '0' AND `rait` < '100' ");

while ($post = $q -> fetch())
{


    if($post['rait'] + $post['rait_us'] >= '100')
        DB::$pdo->query("UPDATE `users` SET `rait` ='100' WHERE `id` = '".$post['id']."' LIMIT 1");
    else
        DB::$pdo->query("UPDATE `users` SET `rait` ='".($post['rait'] + $post['rait_us'])."' WHERE `id` = '".$post['id']."' LIMIT 1");


    DB::$pdo->query("UPDATE `users` SET `rait_us` ='0.00',`time_us` = '0',`time_award` = '0' WHERE `id` = '".$post['id']."' LIMIT 1");
}