Файл: adm/reg.php
Строк: 25
<?
include_once '../system/sys.php';
include '../system/funcs.php';
if(!$cms->us['id'] or $cms->us['level']<2){
header('location: /');
exit;
}
verh('Регистрация','Регистрация');
if(isSet($_GET['id'])){
$id = $func->num($_GET['id']);
if(!empty($id)){
$reg = DB::$dbs->queryFetch("SELECT * from `reg` where `id` = ?",array($id));
if($reg != 0 && $reg['ok'] != 1){
if(isSet($_GET['yes'])){
DB::$dbs->query("UPDATE `reg` set `ok` = ?, `kem` = ? where `id` = ?",array(1,$cms->us['id'],$id));
}elseif(isSet($_GET['no'])){
DB::$dbs->query("UPDATE `reg` set `ok` = ?, `kem` = ? where `id` = ?",array(2,$cms->us['id'],$id));
}
}
}
header("location: /adm/reg.php");
}
$num = 10;
$posts = DB::$dbs->querySingle("SELECT count(id) from `reg` where `ok` = ?",array(isSet($_GET['otkl']) ? 2:0));
$total = intval(($posts - 1) / $num) + 1;
$page = abs(intval($_GET['page']));
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
if($posts == 0){ echo '<div class="list1">Регистраций, требующих активацию нет!</div>'; }else{
$regs = DB::$dbs->query("SELECT * from `reg` where `ok` = ? limit $start,$num",array(isSet($_GET['otkl']) ? 2:0));
while($reg = $regs->fetch()){
$reg_us = DB::$dbs->queryFetch("SELECT * from `us` where `id` = ?",array($reg['us']));
echo '<div class="list1">'.$func->uNick($reg['us']).': [<a href="/adm/reg.php?id='.$reg['id'].'&yes">активировать</a>] '.(isSet($_GET['otkl']) ? NULL:'[<a href="/adm/reg.php?id='.$reg['id'].'&no">отказать</a>]').'</div>';
}
echo "<div class='navg'>";
$func->page('?');
echo "</div>";
}
echo '<div class="navg"><a href="/adm">Вернуться</a></div>';
niz();
?>