<?php 
if (!defined('NTLCMS')) die('<center><b>Restricted access</b></center>');			
$sql = DB :: run() -> query("select * from `users` where `credit` = '0' and `bank` >= '10' and `lasttime` < '".(TIME - 259200)."'");			
while($row = $sql -> fetch(PDO::FETCH_OBJ)){
$sites = DB :: run() -> querySingle("select count(`id`) from `sites` where `login` = ?", array($row -> login));
$banned = DB :: run() -> querySingle("select count(`id`) from `ban` where `who` = ?", array($row -> login));
if ($row -> credit == 0 && $sites > '0' && $banned != '1' && $row -> bank >= '10'){
$summa = 10; $logins = $row -> login;
DB :: run() -> query("update `users` set `credit` = `credit` + ? where `login` = ? limit 1", array($summa, $logins));
DB :: run() -> query("update `users` set `bank` = `bank` - ? where `login` = ? limit 1", array($summa, $logins));
DB :: run() -> query("update `sites` set `active` = ? where `login` = ?", array(1, $logins));
}
}
?>