<?php

include 'conf/dbc.php';
include 'conf/session_start.php';
$page_title = 'Админ-панель';
include 'conf/head.php';
include 'conf/top.php';
$user_id = abs(intval($_SESSION['id']));
$pdo->exec("update users set location = 'adminka' where id = '$user_id' limit 1");

$user_id=abs(intval($_SESSION['id']));
$row=$dbc->query("SELECT * FROM `users` WHERE`id`='$user_id' LIMIT 1")->fetch_assoc();
if($row['admin']<>'1'){header('location: /');}
switch($_GET[mod]){
default:
echo '<br/><center><p class="name2">Админ панель</p></center>';
echo'<div class="menu3"><div class="menu3_text">';
if(isset($_GET['admin']))
{
include_once 'inc/admin.news.php';
echo'</div>';
}
echo "
<div class='line'></div>
<a class='player title' style='text-decoration:none;' href='?admin'><img src='inc/new.gif'> Добавление Новости</a></p>
<div class='line'></div>
<a class='player title' style='text-decoration:none;' href='ad_smile.php'><img src='inc/new.gif'> Добавление смайлов</a></p>
<div class='line'></div>
<a class='player title' style='text-decoration:none;' href='monster_all.php'><img src='inc/arrow.png'>Управление мутантами <span class='red'>(Сарума)</span></a></p>
<div class='line'></div>
<a class='player title' style='text-decoration:none;' href='blist.php'><img src='inc/arrow.png'>Список заблокированных</a></p>
<div class='line'></div>
<a class='player title' style='text-decoration:none;' href='adm_chat.php'><img src='inc/arrow.png'>Комната совещаний</a></p>
<div class='line'></div>";

echo'</div></div>';
break;
case 'vip':
$user_id = abs(intval($_SESSION['id']));
$usid=abs(intval($_GET['id'])); 

if(isset($_POST['time'])){
$usid=intval($_GET['id']);
$time=time()+$_POST['time'];
$dbc->query("Update `users` set `vip`='1', `viptime`='$time' where `id`='$usid'");
 header ('Location: ?id='.$usid.'&mod=vip_ok');
  exit();
}
break;
case 'vip_ok':
$user_id = abs(intval($_SESSION['id']));
$usid=abs(intval($_GET['id'])); 
$query = $pdo->query("Select * from users where id = '$usid' limit 1");
$vip= $query->fetch();
echo '<center><p class="name2">Админ панель</p></center>';
echo"<font color='gold'>Игроку <a  style='text-decoration:none;' href='user.php?id=".$usid."'>".$vip['nick']."</a> выдан vip-статус!</font>";
echo'<div class="r2"><a  style="text-decoration:none;" href="user.php?id='.$usid.'&vid=adm"><img src="inc/arrow.png">В админ-панель</a></div>';

break;
}
require_once('conf/navig.php');
require_once('conf/foot.php');
mysqli_close($dbc);
?>