<?php
$title = 'Движение средств';
require ($_SERVER['DOCUMENT_ROOT'].'/core/sys.php');
require ($_SERVER['DOCUMENT_ROOT'].'/core/head.php');
if(!isset($user)){
header('Location: /');
exit;
}
if($user['id'] != 1){
header('Location: /');
exit;
}
?><div class="top"> Движение средств </div><?
$k_post = $db->prepare("SELECT * FROM `history_money`");
$k_post -> execute();
$k_post = $k_post -> rowCount();
if($k_post == 0){
?><div class="box"><center>Пусто</center></div><?
}
$max = 10;
$k_page = k_page($k_post,$max);
$page = page($k_page);
$start = $max*$page-$max;
$all = $db->prepare("SELECT * FROM `history_money` ORDER BY `id` DESC LIMIT $start, $max");
$all -> execute();
$all = $all -> fetchAll();
foreach($all as $row){
if($row['money'] > 0) $color = 'green'; else $color = 'red';
echo '
<div class="box">
                <b>ID:</b> '.$row['id'].' ['.nick($row['us']).']<br/>
                <b>Время:</b> '.vremja($row['time']).'<br/>
                <b>Сумма:</b> <span style="color:'.$color.'"><b>'.$row['money'].'</b></span><br/>
                <b>Комментарий:</b> '.$row['comm'].'<br/>
            </div>
';


}

if($k_page >1){
echo str('/panel/my/log.money.aspx',$k_page,$page);
}
require ($_SERVER['DOCUMENT_ROOT'].'/core/foot.php');
?>