Файл: 4mast/profmas.ru/adm/mod.php
Строк: 44
<?php
require_once('../includes/Headers.php');
require_once('../includes/PDO_func.php');
if($us == false) {
header ('location: /login/auth');
exit;
}
if ($us['level'] < 1) {
header ('location: /');
exit;
}
$admin = (isset($_GET['admin']) AND !empty($_GET['admin'])) ? addslashes(htmlspecialchars($_GET['admin'])) : false;
switch($admin){
default:
header('location: /adm');
break;
case 'rega':
H('Модерация', 'Одобрение регистраций');
if($do) {
if (!isset ($_GET['u'])) {
header ('location: /adm/mod.php?admin=rega');
exit;
}
$query = DB :: $dbs -> query ("SELECT * FROM `reg` WHERE (`us`=?)", array ((int) $_GET['u']));
if ($query -> rowCount () == 0) {
header ('location: /adm/mod.php?admin=rega');
exit;
}
else {
$reg = $query -> fetch ();
if($do == 'yes'){
DB :: $dbs -> query ("UPDATE `reg` SET `dop`='da', `kem`='" . $us['id'] . "' WHERE (`us`='" . $reg['us'] . "')");
header ('location: /adm/mod.php?admin=rega');
}
elseif($do == 'no'){
DB :: $dbs -> query ("UPDATE `reg` SET `dop`='net', `kem`='" . $us['id'] . "' WHERE (`us`='" . $reg['us'] . "')");
header ('location: /adm/mod.php?admin=rega');
}
}
}
$items_per_page = 10;
$items = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `reg` where `dop` = 'mod'");
$pages = ( ( $items - 1 ) / $items_per_page ) + 1;
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 `reg` WHERE `dop`= 'mod' order by `id` DESC LIMIT $start, $items_per_page");
while ($reg = $query -> fetch()) {
$u = DB :: $dbs -> queryFetch ("SELECT id,ip,soft,nick FROM `us` WHERE `id` = ?", array ($reg['us']));
$klon = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `us` WHERE (`ip` = '".$u['ip']."')");
echo '<div class="list1">';
echo Nick ($u['id']);
echo '<br /><b>IP: </b><a href="/adm/search_ip/osn/' . $u['ip'] . '">' . $u['ip'] . '</a> <a href="/adm/search_ip/logs/' . $u['ip'] . '"> [!!!] </a>';
echo '<br /><b>Софт: </b>' . $u['soft'];
echo'<br /><b>Возможные аккаунты: </b>';
if ( $klon <= 1) {
echo 'Не обнаружены';
} else {
$klons = DB::$dbs->query( "SELECT * FROM `us` WHERE (`ip` = '".$u['ip']."') AND (`id` != '" . $u['id'] . "') ORDER BY `id` DESC");
while ( $klony = $klons -> fetch() ) {
echo '<a href="/us' . $klony['id'] . '">' . $klony[ 'nick' ] . '</a>, ';
}
}
echo '<br />- <a href="/adm/mod.php?admin=rega&u='.$u['id'].'&do=yes">Одобрить</a>';
echo ' | ';
echo ' <a href="/adm/mod.php?admin=rega&u='.$u['id'].'&do=no">Отклонить.</a>';
echo '</div>';
}
echo page ('/adm/rega');
}
break;
}
echo '<div class="block"><a href="/adm">Вернуться</a></div>';
require_once('../includes/Footers.php');
?>