<?php
require_once 'core/system.php';
echo only_reg();
$header = 'Шахта';
require_once 'core/head.php';
?>
<?

	$taxi_time = intval($_GET['time']);
	$time = time();
	if($user['shahta_start'] == '0')
	{
	if(isset($_GET['shahta']))
	{
		if(isset($taxi_time))
		{
			if($taxi_time == 1)
			{
			$time_plus = '1800';
			}
			elseif($taxi_time == 2)
			{
			$time_plus = '3600';
			}
			elseif($taxi_time == 3)
			{
			$time_plus = '7200';
			}
			elseif($taxi_time == 4)
			{
			$time_plus = '14400';
			}
			elseif($taxi_time == 5)
			{
			$time_plus = '28800';
			}
			$time_db = $time + $time_plus;
			mysql_query("UPDATE `user` SET `shahta_time` = '".$time_db."' WHERE `id` = '".$user['id']."'");
			mysql_query("UPDATE `user` SET `shahta_start` = '".$taxi_time."' WHERE `id` = '".$user['id']."'");
			mysql_query("UPDATE `user` SET `shahta` = '1' WHERE `id` = '".$user['id']."'");

			header("Location: shahta.php");
			exit();
		}
		else
		{
		header("Location: shahta.php");
		exit();
		}
	}
	else
	{
	header("Location: shahta.php");
	exit();
	}
	}
	else
	{
	header("Location: shahta.php");
	exit();
	}

?>