Файл: 4mast/profmas.ru/adm/arb_mod.php
Строк: 19
<?php
require_once('../includes/Headers.php');
require_once('../includes/PDO_func.php');
if (!isset ($us['id'])) {
header ('location: /');
exit;
}
if ($us['level'] < 2) {
header ('location: /');
exit;
}
H ('Арбитраж', 'Арбитраж');
if (isset($_GET['da'])) {
$in = DB::$dbs->queryFetch("SELECT * FROM arb WHERE id = ? LIMIT 1",array(intval($_GET['id'])));
DB :: $dbs -> query ("UPDATE arb SET status = ? WHERE id = ?",array(0,abs(intval($_GET['id']))));
header('location: ?');
}
if (isset($_GET['net'])) {
DB :: $dbs -> query ("DELETE FROM arb WHERE id = ?",array(abs(intval($_GET['id']))));
header('location: ?');
}
$items = DB :: $dbs -> querySingle("SELECT COUNT(id) FROM arb WHERE status = ?",array(1));
$items_per_page = 10;
$pages = ceil ($items/$items_per_page);
if ($page < 1) {
$page = 1;
}
if ($page > $pages) {
$page = $pages;
}
$start = $page * $items_per_page - $items_per_page;
if ($items==0) {
echo '<div class="error">Отзывов/Претензий еще нет</div>';
} else {
$query = DB :: $dbs -> query("SELECT * FROM arb WHERE status = ? ORDER BY time DESC LIMIT $start, $items_per_page",array(1));
while ($arr = $query -> fetch()) {
echo '<div class="lst"><b>'.($arr['type'] == 1 ? 'отзыв':'претензия').'</b> от: <a href="/us'.$arr['id_user'].'">'.Nick($arr['id_user']).'</a> для <a href="/us'.$arr['user_id'].'">'.Nick($arr['user_id']).'</a> ('.datef($arr['time']).')<br/>'.tag($arr['text']).'<br/><a href="/files/arb/'.$arr['path'].'"><img src="/files/arb/'.$arr['path'].'" width="80" height="80" alt="*"/></a></div><div class="error"><a href="?da&id='.$arr['id'].'">[подтвердить]</a> / <a href="?net&id='.$arr['id'].'">[отклонить]</a></div>';
}
///echo '<div class="lst">' . pages ('?') . '</div>';
}
echo '<div class="block"><a href="/adm">Вернуться</a></div>';
require_once('../includes/Footers.php');
?>