<?php

require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
if ((!isset($_SESSION['id'])) or (!isset($_SESSION['nick'])))  {
?>
<script type="text/javascript">
  document.location.href = "login.php";
</script>
<?php
}
$user_id=abs(intval($_SESSION['id']));
$user=$dbc->query("SELECT * FROM `users` WHERE`id`='$user_id' LIMIT 1")->fetch_assoc();
if($user[lvl]<10){header('location: tainiki.php');exit();}
switch($_GET[tip]){
default:
header('location: tainiki.php');
break;
case '1':
if($user['tainik']>= 1) {
header('location: tainiki.php');
}else{
$time=time()+1800;
$dbc->query("UPDATE `users` SET `tainik` =  '1', `tainik_time` = '$time', `tainik_tip` = '1'  WHERE `id` ='".$user_id."' LIMIT 1");
header('location: tainiki.php');
exit();}
break;
case '2':
if($user['tainik']>= 1) {
header('location: tainiki.php');
}else{
$time=time()+5400;
$dbc->query("UPDATE `users` SET `tainik` =  '1', `tainik_time` = '$time', `tainik_tip` = '2'  WHERE `id` ='".$user_id."' LIMIT 1");
header('location: tainiki.php');
exit();}
break;
case '3':
if($user['tainik']>= 1) {
header('location: tainiki.php');
}else{
$time=time()+10800;
$dbc->query("UPDATE `users` SET `tainik` =  '1', `tainik_time` = '$time', `tainik_tip` = '3'  WHERE `id` ='".$user_id."' LIMIT 1");
header('location: tainiki.php');
exit();}
break;
case '4':
if($user['tainik']>= 1) {
header('location: tainiki.php');
}else{
$time=time()+21600;
$dbc->query("UPDATE `users` SET `tainik` =  '1', `tainik_time` = '$time', `tainik_tip` = '4'  WHERE `id` ='".$user_id."' LIMIT 1");
header('location: tainiki.php');
exit();}
break;
}
  ?>